Download

Setting materials to UProceduralMeshComponent

I got the entire mesh to have a material but is there a way to make certain parts of the mesh use different materials? I know with premade meshes like from 3dsmax you can do element IDs…
I tried searching but there is not a lot on the 4.8 + UProceduralMeshComponent and materials

Mesh == UProceduralMeshComponent in this code



auto TheMaterial_Dyn = UMaterialInstanceDynamic::Create(GrassMaterial, this);
Mesh->CreateMeshSection(0, meshData->Vertices, meshData->Triangles, meshData->Normals, meshData->UV, meshData->VertexColors, meshData->Tangents, true);
Mesh->SetMaterial(0, TheMaterial_Dyn);


I’m trying to do this from c++ not blueprint if possible