Hello, I’m wondering if there is a way to specify a separate value for each vertex when setting a custom buffer for mesh instances? All the examples I could find are using the same value for each vertex: Instances | Babylon.js Documentation
Welcome aboard!
It’s not possible to have per vertex per instance data using an attribute. You can do it using a texture that will lookup the data by using the gl_VertexID / gl_InstanceID predefined variables. See for eg:
2 Likes
TYVM those indexes & playground are very helpful indeed!
Hmm, it looks like the gl_VertexID indexes are in a different order than the vertex data gotten and set by getVerticesData() and setVerticesData(), but I used setVerticesData() to create my own vertexIndex attribute and that is working well.
1 Like