-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
InstanceNode: Add support for StorageInstancedBufferAttribute #32240
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
base: dev
Are you sure you want to change the base?
InstanceNode: Add support for StorageInstancedBufferAttribute #32240
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
| } else { | ||
|
|
||
| const buffer = new InstancedInterleavedBuffer( instanceMatrix.array, 16, 1 ); | ||
| // Both backends have ~64kb UBO limit; fallback to attributes above 1000 matrices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated side note: This comment isn't 100% correct since the WebGL 2 backend has a guaranteed size of only 16KB, see #30560 (comment). 64KB is supported on most platforms though. It would still be safer to set count to a smaller value.
Description
Add support for direct usage of
StorageInstancedBufferAttributeforinstanceMatrixofInstancedMesh(or any type of Mesh tagged withmesh.isInstancedMesh.For example:
Can be very useful for advanced usage without having to create complex nodes by naturally make use of the
InstancedNodeand NodeMaterial pipeline.Alternative would be to expose InstanceNode and patch via prototype the old WebGLRenderer way which I don't recommend.
This contribution is funded by Utsubo & Three.js Blocks