Node Material Editor - instance color

Is instance color supported in node material editor?
I want to get instance color from instance buffers and pass it onto the fragment output

Gopinath Vellingiri

Vertex colors are exposed as mesh.color in the Nodematerial Editor. (Look under Mesh → Color)

Hi @Raggar,
I am asking about Instance Color through instanced buffers not vertex color.
In Instance block, transformations are available but colors are not available.

Gopinath Vellingiri

1 Like

But vertex colors Are part of the vertex buffer of the mesh(assigned to each vertex):

If you are looking to assign some other variable as an attribute, look at this:


In a typical CAD assembly, not all instances will have instance color.
Instances without instance color has to be rendered with mesh(vertex) color.

In above NME sample, I have to choose mesh color if instance color is not available.
Usually Instance property includes Color and Transformations.
Currently NodeMaterial block ‘Instances’ doesnot have a InstanceColor output.
So, I am forced to Clone the mesh instead of instancing which increases number of meshes and draw calls,
thereby reducing performance.

If I use the below example, I dont have control which color gets applied to the mesh finally

I prefer a InstanceColor output from “Instances” NME block.



If you use the attribute named “color” for your instances, it will replace the regular “vertex color” attribute. What you can do is name your instance color something else, so that you can have both the vertex color and instance color attributes:

Use the setAsAttribute method of the input block to transform this input to an attribute.