You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to include a custom per-instance attribute to an Instance?
I have InstancedMesh, InstancedGeometry and ShaderMaterial where I need to use per-instance attributes.
In the docs we have no example for this. There are position, rotation scale and color available like so:
What in case of custom attribute to be used inside shader code? I have the following: Float32BufferAttributes for primitive geometry setup and InstancedBufferAttribute to be included
I think your code should work, I have tried attaching InstancedBufferGeometry and InstancedBufferAttribute to InstancedMesh in the same way and it is working ok. If you console.log and inspect the geometry does it look like everything is attached properly?
eg: <T.InstancedBufferGeometry attach="geometry" on:create={(ibg) => console.log(ibg.ref)}>.
Also in your code above if you are using count as the 4th args parameter in InstancedBufferAttribute I think it will repeat the same attribute for every instance... unless I have misunderstood what you are trying to do!
How to include a custom per-instance attribute to an Instance?
I have InstancedMesh, InstancedGeometry and ShaderMaterial where I need to use per-instance attributes.
In the docs we have no example for this. There are position, rotation scale and color available like so:
What in case of custom attribute to be used inside shader code? I have the following:
Float32BufferAttributes
for primitive geometry setup andInstancedBufferAttribute
to be includedThanks for help!
The text was updated successfully, but these errors were encountered: