-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebGLRenderer: Add uploadGeometry function #27080
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
I'm not sure about introducing this method on renderer level. Especially since we need to carry it over to When I understand the issue correctly, the limited factor right now is that Besides, could |
I'd be happy with supporting multiple updateRanges per geometry, as well, and would allow this to happen more transparently.
It is definitely too expensive. See #27078 (comment). If it wasn't then batching with something like multidraw arrays would be useless. You'd just merge and then rearrange geometry, instead. |
@Mugen87 is this something you can support? This is what I'm imagining:
|
The methods sounds good to me. However, I would leave out If we add |
Agreed - I figured we would have backwards compatibility support for the typical 10 releases, though. I'll make a PR when I get the chance. |
Related issue: #27078
Description
Adds
WebGLRenderer.uploadGeometry
which is for geometry ascompile
is for materials andinitTexture
is for textures. It uploads any necessary buffer attributes, respecting any "updateRange" values if needed.I've run into this issue a number of times but it's particularly noticeable with frequent BatchedMesh geometry updates (see demo in #27078, also mentioned here) since any change in loaded geometry means reuploading the entire large attribute buffer which can be unnecessarily slow and ultimately undermine any benefits from the batched mesh in the first place. Instead if you only update 4 out of 800 geometries in a BatchedMesh you should only upload the changed ones immediately, which this enables:
In the tiles renderer demo I'm doing this to force an update of the geometry on change since you can't specify multiple update ranges:
I can add documentation if this is merged.