Comments (6)
@xingxiang1227 high resolution images consume an enormous amount of memory. With TextureLoader, the compressed image is held in CPU memory, and the first time it's rendered, the WebGL API is blocked while decompressing and uploading it to the GPU. For a 4K texture that's 90 MB of memory.
The reason we use ImageBitmapLoader is that it moves the decompression off the main thread, allowing us to block rendering for a shorter amount of time. The memory cost on the GPU is the same. I'm unsure of the difference in CPU memory, or whether Chrome's Task Manager is able to measure both accurately.
Additionally, the Web Workers used to decode Draco-compressed data will need some unknown amount of CPU memory.
You can opt out of both in your own application – for example, using TextureLoader or (better yet) KTX2 compressed textures. See my blog post, Choosing Texture Formats for WebGL and WebGPU, for more on that. Or you can skip using Draco compression in favor of lighter-weight Meshopt compression or quantization.
These all have tradeoffs, among which CPU memory is just one, so I'm not sure there's much we can change about the Editor here. If you're having particular problems managing memory in your own application, please feel welcome to start a thread in https://discourse.threejs.org/ and we can probably help you optimize memory there.
from three.js.
The editor may be saving the textures as jpeg into indexedDB. Is that what you're trying to report?
And... Is 290,068 kb really high memory usage for you?
from three.js.
Might be related to the Web Workers spawned and WASM allocated while decoding Draco compression. I'm not sure if the editor keeps those workers around for reuse, or disposes them eventually. For this particular model, the geometry is not that heavy – Meshopt compression might be more appropriate.
This model also contains two 4K textures, with estimated GPU memory cost of 90 MB each. My confidence is low that Chrome's tab manager reports GPU memory accurately, but the numbers here do seem within reason.
from three.js.
The editor may be saving the textures as jpeg into indexedDB. Is that what you're trying to report? And... Is 290,068 kb really high memory usage for you?
Hello, in my actual project, a 150MB model, when loaded through GLTFLoader, ultimately occupies 3GB of memory, whereas when stored through indexedDB and rendered again, it only occupies around 700MB. Is there room for optimization in memory management when using GLTFLoader for loading?
from three.js.
Might be related to the Web Workers spawned and WASM allocated while decoding Draco compression. I'm not sure if the editor keeps those workers around for reuse, or disposes them eventually. For this particular model, the geometry is not that heavy – Meshopt compression might be more appropriate.
This model also contains two 4K textures, with estimated GPU memory cost of 90 MB each. My confidence is low that Chrome's tab manager reports GPU memory accurately, but the numbers here do seem within reason.
After my testing, for models with many textures, the memory usage when using GLTFLoader for loading is much higher than that after conversion through indexedDB. Is there room for optimization in memory management when using GLTFLoader?
from three.js.
In the GLTFLoader.js file, within the GLTFParser class, the textures are loaded using this.textureLoader = new ImageBitmapLoader( this.options.manager )
, which results in a high memory footprint. After I replaced it with this.textureLoader = new TextureLoader( this.options.manager )
, the memory usage became normal. The memory consumption of the former is about 6 times that of the latter. Is there a way to optimize the memory usage of ImageBitmapLoader?
from three.js.
Related Issues (20)
- TransparencyFactor not fully handled by FBXLoader HOT 4
- MaterialX: Add support for extract node HOT 1
- BufferGeometry.setFromPoints() incompatible with WebGPURenderer
- ConeGeometry contains degenerate triangles HOT 3
- invalid example links in documentation HOT 1
- webXR button does not switch to third state when fullscreen VR is exited using the controller HOT 11
- BatchedMesh: Plans for adding "optimize" function
- BatchedMesh: Plans for adding a "resize" function HOT 5
- Directional light shadow issue (cameraPosition uniform has incorrect value in depth material shader) HOT 4
- NURBSCurve.toJSON doesn't serialize points data HOT 6
- After rotating the x-axis 90 degrees and then rotating the y-axis 90 degrees, the result is an incorrect angle HOT 1
- BatchMesh triangles arent count in the renderer.info.render.triangles
- TSL: Normal accessors break when called in both ends of the select node HOT 1
- I have a problem with OrbitControls HOT 3
- WebXRManager sessionstart event does not wait for XRReferenceSpace to be fully initialized. HOT 8
- FBXLoader: Invalid request to /undefined HOT 3
- WebGPURenderer: Concurrency issue. HOT 1
- Changing InstancedMesh count from 10000 to 100 throws error with WebGPU. HOT 2
- webgpu can't use multiple materials in a cube HOT 2
- Move some WebGPU modules from core to addons. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three.js.