-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
InstancedBufferGeometry.instanceCount incorrectly #19595
Comments
@sanddyl Can you please provide a simple, live demo to show exactly what you did to cause the issue? |
|
You are resizing the attribute buffer. That is not supported. See https://threejs.org/docs/#manual/en/introduction/How-to-update-things. /ping @Mugen87 for confirmation. |
I quite agree,but when I need to modify maxInstanceCount, instanceCount can not achieve my purpose, even if this is rare. I mean, the instanceCount in version 117 is not equal to the maxInstancedCount in the previous version. |
Maybe both maxInstancedCount and instanceCount are required. |
Yes, buffers can't be resized. The idea is to create a sufficiently sized buffer and then control via
Nope. It does work by just using |
Thanks a lot ! I will avoid such problems in the future. |
Fixes #69. This works around an issue introduced in Three r117 where a given geometry uses the size of any InstancedBufferAttribute as a max for `instanceCount`, and caches that for the lifetime of the geometry even if the attribute is replaced with one of a different size. It's unclear if this is a ThreeJS bug or a if our approach of "resizing" by replacing the attribute is truly unsupported; the discussion in mrdoob/three.js#19706 is ambiguous, mrdoob/three.js#19595 implies it's not allowed, and mrdoob/three.js#17418 implies it should be allowed.
Description of the problem
When I changed InstancedBufferGeometry.instanceCount, I found that the _maxInstanceCount not changed. This will cause the InstancedBufferGeometry to display incorrectly.
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: