InstancedBufferGeometry not updated properly between render calls
See original GitHub issueWhen you use InstancedBufferGeometry
without using InstancedMesh
, your geometry attributes are not updated properly. Here’s the culprit:
Part of the fix would be to check the geometry
and not the object
. That is if the geometry.isInstancedBufferGeometry
instead of checking for InstancedMesh
specifically.
Frankly, looking in the binding states implementation - I’m puzzled by the fact that version of the attribute is never checked against the cache, it basically says “oh, look, it’s the same object reference, no update needed”. Or I’m missing something.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
can't get a Three.js InstancedBufferGeometry to appear in a ...
When using InstancedBufferGeometry , you can't create a mesh with ... innerHeight, 0.1, 1000); camera.position.z = 100; scene = new THREE.
Read more >InstancedMesh from GLTF doesn't work?! - Questions
Hi, InstancedMesh ([1] in code) doesn't work when geometry loaded from GLTF - is this ... InstancedBufferGeometry was the first API for instanced...
Read more >Instancing with three.js — Part 2 | by Dusan Bosnjak
Notice two things — the number is much smaller than the number of entities created in the demo (2000) and it changes between...
Read more >Fluffy predator with THREE.js & instanced geometry
Working with instances is slightly different from using regular meshes. ... //creates an instancedBufferGeometry var geometry = new THREE.
Read more >how to use InstancedBufferGeometry with threejs-three.js
js shape from a series of contours? Broken lights with the normal map shader · Why are new lines added to THREE.Line not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since
InstancedGeometryBuffer
is updated as expected I think it’s okay to close the issue.You’re absolutely right, I guess I’m the first person to have a use-case to modify geometry while assembling a single frame.
For the case of shadow map in three.js - geometry is assumed to remain the same, which is a perfectly valid assumption.
In case anyone’s interested, the reason why it matters for me - is because of the virtual geometry, that is, depending on the view geometry might be drastically simplified, so shadowmaps and the main view may render drastically different number of triangles for the same mesh, depending on the shadowmap resolution, size of the object in the view and a few other factors.