Procedurally created cube has flat shading / lighting and I don't know why

Maderschaden
Sat, 11 Feb 2023 17:51:05 +0000
Blueprint

Hi everybody.

I have a problem: I am trying to create a cube procedurally via the Procedural Mesh Component. The generation itself is working, but the problem is that my cube is totally flat-shaded and I really do not know one, though I suspect it has something todo with the UVs or normals of my mesh section. As you can see in the images, I have 8 vertices arranged to form the cube and I draw triangles between them all fine so far. But I really do not understand how to assign the UV coordinates to these 8 vertices correctly.

These are the normals which I am using, all pointing from the respective corner directly outwards:

What I already tried was treating them as 2 seperate squares (bottom and top) and have them arranged between (0,0) and (1,1) like this:

But that just leads to the flat shaded outcome. Same happens for all (0,0) and all (1,1).

When I try to let the system calculate the normals and tangents like this:

The outcome looks totally weird:

The problem is I do now about the usual Cube UV splitting thingy but I do not know how this applicable here. Because I only have 8 vertices and I cannot “split a vertex in half” so I do not know where on this uv system my vertices should lie. For example the right side of my cube is vertices (0,1,4,5) so I have don’t know where on my UV scale vertex 0 should lie, in the top right corner for the bottom face, or in the bottom left corner for the right side.

Because this is my current arrangement for the UV space:

And I have no clue how and where the side faces lie in this. Can anybody help me with this?

1 post - 1 participant