Pass index of current thin instance to shader?


I am creating a custom material based on PBR, but I would like to know the best way to pass the shader the current instance/thin instance index it is working on, because I need to pass an array as uniform to the vertex shader and read the proper index.

Should I replicate what you do for vertex, normals and colors or is there a simpler way (the former implies lots of modification in the source code, and that’s what I would like to avoid as much as I can)?


gl_InstanceID is the first thing that comes to my mind. You may check whether this helpfull for you.

1 Like

Nice! I thought I would have to rely on something complicated, but this is the answer I am after, thanks Axel