🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Triangle color is not displayed correctly

Started by
1 comment, last by JohnnyCode 4 years, 9 months ago

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!

Advertisement

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.

This topic is closed to new replies.

Advertisement