Announcement

Collapse
No announcement yet.

Procedural mesh component with multiple materials issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Procedural mesh component with multiple materials issue

    Hello,

    I'm having troubles creating a terrain with a procedural mesh component: I assign a different material to each section of the meshes (I made the materials editable from the editor) but when I run the game, the meshes appear as if only one was used.. (even though sometimes, it behaves correctly).

    Anyone has an idea about it? Here is the portion of code handling the stuff with material and mesh:
    Code:
        UProceduralMeshComponent* mesh = m_chunks[index];
    
        processChunk(chunk, vertices, triangles, normals, 2);
        mesh->CreateMeshSection_LinearColor(0, vertices, triangles, normals, uv0, colors, tangents, true);
    
        processChunk(chunk, vertices, triangles, normals, 3);
        mesh->CreateMeshSection_LinearColor(1, vertices, triangles, normals, uv0, colors, tangents, true);
    
        mesh->SetMaterial(0, GroundMaterial);
        mesh->SetMaterial(1, CoalOreMaterial);
    Thanks in advance
Working...
X