I have following scene with instaced cylinder with edge rendering:
Now I want to color the cylinders “vertex-wise” for example the top and bottom of the cylinder should be black and lateral surface green.
Is there a performant way to do this?
Side question: Is it possible to do the same with thin instanced? I would also like to implement picking in the next step.
The cylinders have all the same “color distribution” and only when selected I want to change the vertex colors of one specific cylinder. In other engines I can do this with bufferattributes likes “colors” instead of “color” but it seems like it works differenttly
vertex colors is simple and supported in babylon, but you can not change it per instance, like you can not change the position buffer per instance. in this case you could probably use a custom shader like from NME where you mix the colors based on an attib value so the selected one could have a different color set than the others and only the gradient info is stored in the attributes.
@sebavan was speaking about the position buffer, meaning the position of each of the vertex individually: you can change the global position for each instance but not their vertex coordinates. Same thing for the vertex color buffer: you can have a different global color for each different instance but not a different color for each vertex for each instance.