Search code examples
c++meshunreal-engine4

Material with several colors for mesh in Unreal Engine


I have a mesh presented as UProceduralMeshComponent. Also I have a set of colors: one color for each vertex of this mesh.

I'm looking for a way to create a dynamic material in which all these colors will be and they will correspond to the coordinates of the vertices. It should look something like this:

enter image description here

Does anybody know the way how to implement it?


Solution

  • UProceduralMeshComponent::CreateMeshSection accepts an array of vertex colors. Pass an array of colors for each vertex and use a VertexColors node in your material.