BufferGeometry attribute usage and GPU memory overhead
22K reputation · 02 Mar 2021, 04:45 UTC
Optimizing GPU memory in Three.js requires a balance between vertex precision and resource allocation. When utilizing BufferGeometry, developers can define custom attributes using typed arrays to manage how vertex data is stored and transmitted to the GPU.
The setUsage() method allows for hinting whether an attribute is static or dynamic, which informs the driver's optimization strategy. However, there is uncertainty regarding the memory footprint when switching between different typed arrays for attributes in high-density scenes where precision requirements vary across different vertex properties.
Technical Constraints
- Requirement to minimize GPU memory pressure in long-running sessions.
- Need to maintain visual fidelity while reducing the overhead of
Float32Array. - Dependence on explicit
dispose()calls to prevent leaks.
Does the setUsage() hint impact the actual memory allocation of the attribute, or only the transfer frequency? To what extent does using smaller typed arrays for custom attributes reduce the total GPU memory footprint compared to standard Float32Array implementations?