Skip to content
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

Replacing an attribute of a geometry instanced by another new attribute with a superior length break the renderer #30168

Open
Samsy opened this issue Dec 19, 2024 · 4 comments
Labels

Comments

@Samsy
Copy link
Contributor

Samsy commented Dec 19, 2024

Description

On previous version of Three.JS, ( r162 havnt tested between then and now ) ,we were able to replace an entire instancedgeometry attribute with a new length and set the instanceCount to a superior value

This is a valuable feature for performances if you play with huge dynamic instanced geometry that increments count over time and allows to first allocate a smaller buffer then grow with a safe multiple to limit the size of the buffer

But this also limits flexibility of building geometries by a lot

In both WebGL and WebGPU back end it now breaks the renderer :

Screenshot 2024-12-19 at 15 02 09

Look at the switchArray function

Live example

@Samsy Samsy changed the title Replacing an instancebuffer attributes break the app Replacing a geometry instanced attributes with a superior length break the renderer Dec 19, 2024
@Samsy Samsy changed the title Replacing a geometry instanced attributes with a superior length break the renderer Replacing a geometry instanced attribute with a superior length break the renderer Dec 19, 2024
@Samsy Samsy changed the title Replacing a geometry instanced attribute with a superior length break the renderer Replacing a geometry instanced attribute by another with a superior length break the renderer Dec 19, 2024
@Samsy Samsy changed the title Replacing a geometry instanced attribute by another with a superior length break the renderer Replacing an attribute of a geometry instanced by another new attribute with a superior length break the renderer Dec 20, 2024
@Samsy
Copy link
Contributor Author

Samsy commented Dec 23, 2024

maybe @RenaudRohlinger knows about it ?

@RenaudRohlinger
Copy link
Collaborator

Ah yes, it's because the instance node is created when the material is first mounted, you need to add material.needsUpdate =true.

https://jsfiddle.net/4pk7csru/4/

@Samsy
Copy link
Contributor Author

Samsy commented Dec 23, 2024

@RenaudRohlinger

Here is the updated fiddle with material.needsUpdate = true

Does not seem to work :

https://jsfiddle.net/zjsy4r7a/1/

@RenaudRohlinger
Copy link
Collaborator

oops didn't see my console, indeed, then we need to fix this in InstanceNode.

@Mugen87 Mugen87 added the Bug label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants