Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎯 Unreal

Triangle color is not displayed correctly

Started by _void_ Sep 9, 2019 at 4:02 PM 1 replies 3.1k views
Original Post
_void_
_void_

Hey guys!

I am trying to render a triangle using UProceduralMeshComponent. Even though I setup vertex colors, the triangle is rendered as gray. I have rebuilt lighting.


int32 SectionIndex = 0;
TArray<FVector> Vertices = { FVector(0.0f, 0.0f, 0.0f), FVector(0.0f, 0.0f, 40.0f), FVector(0.0f, 40.0f, 0.0f) };
TArray<int32> Triangles = { 0, 2, 1 };
TArray<FVector> Normals;
TArray<FVector2D> UV0;
TArray<FColor> VertexColors = { FColor(255, 0, 0, 255), FColor(255, 0, 0, 255), FColor(255, 0, 0, 255) };
TArray<FProcMeshTangent> Tangents;
bool bCreateCollision = true;

ProceduralMeshComponent->CreateMeshSection(SectionIndex, Vertices, Triangles, Normals, UV0, VertexColors, Tangents, bCreateCollision);

What could I be wrong? Do I need to set a material for the vertex color? I am not able to find one in the documentation.

Thanks!

JohnnyCode
JohnnyCode

Are you using correct shading material that utilize vertex colors display? Vertex colors are not usualy used for actual color, but often it is textures blending etc.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.