-
-
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
Generalize instanced attributes #26604
Comments
What is the sentiment regarding this suggestion? If it has chance to be accepted, I will gladly prepare a PR. |
I'm not sure what the special treatment is that you're trying to generalize, could you say more about the problem this change is intended to solve? Can InstancedBufferAttibute + |
The The reason is the same as with colors - you want to reuse your geometry for multiple instancing groups. |
When a BufferGeometry is reused by two InstancedMesh objects with different instance transforms or colors ... do we upload that geometry to the GPU only once? Or have separate vertex buffers on the GPU for each? I think |
When you copy or clone a The vertex buffer setup is done in |
Right, I'm aware that cloning a BufferGeometry will duplicate its data on the GPU. I'm less aware of what guarantees we are trying to make, if any, about whether a single geometry reused with different instance attributes will or will not be duplicated. This has implications for future APIs, such as #17089, so I think we need to be clear about the intended outcome and not merge changes that we do not intend to support. |
While I understand the concern about guarantees and promises, I think this should not prevent making the API more orthogonal. I suggest extending the privileged handling which is currently done for placement and color to any custom attributes user may have. What is so special about color it can get this handling, and other parameters cannot? |
Description
Currently there are two instanced attributes which get a special treatment from the engine:
instanceColor
andinstanceMatrix
:I think it would be possible to make this more flexible by allowing any custom attributes present in
InstancedMesh
to get the same treatment.Solution
The code above should be changed to:
The member attributes would be added into
InstancedMesh
.Alternatives
At the moment one can either abuse
instanceColor
if not needing it for coloring, or provide custom attributes in the geometry, which means for different instancing chains the geometry has to be cloned.Additional context
For simplicity I suggest keeping current
instanceMatrix
andinstanceColor
as they are, but perhaps they could also be moved to theattributes
and the code handling them would become simple:This needs some more though, so that backward compatibility is maintained.
The text was updated successfully, but these errors were encountered: