Procedural mesh blueprint UV Tangent Normals

I’m trying to generate a mesh with the procedural mesh blueprint.
I have been searching for a while but I can’t find good documentation.

I understand the use of Vertices and Triangles.

I am lost how to fill the UV Tangent and Normals array’s. I understand that each vertices has also a UV, Tangent and Normal. But which numbers do I have to enter in the array?
Where can I find documentation?

To learn, I generated a “Generate Box Mesh” with blueprint and studied the resulting array’s . I don’t understand the logic yet.
Actually there is something strange with the generated box. In my opinion you need 8 vertices to define a box. The “Generate Box Mesh” generated 24 vertices?

Greetings from the Netherlands

There’s not really one specific way to generate UVs for a procedural mesh. It depends on how you want the UVs.

One neat thing you can do is get world aligned UVs by taking the XY location of the vert, multiplying it by 0.01 (to make each UV 0-1 space equal to 1 meter instead of 1cm) and using that as the UV. This is great for something flat like a road or terrain, however on something like a box it won’t work on the sides without getting more complex.

If you have a grid mesh, then another way to generate UVs is to make each quad of the grid 0-1 space by using the row/column number as the UVs. Example for a 4x4 grid mesh:

[0,0][1,0][2,0][3,0]

[0,1][1,1][2,1][3,1]

[0,2][1,2][2,2][3,2]

[0,3][1,3][2,3][3,3]

I haven’t gone into very complex objects myself, but at least this should help you understand how to start generating UVs.

As for Tangents and Normals, I haven’t learned too much about them yet, but for starting out you can use the “Calculate Tangents for Mesh” node. Even if you don’t have UVs, you can still use this node to calculate Normals.

The reason the “Generate Box Mesh” generates 24 vertices is because of how hard edges work. Each vertex has one normal which defines the direction that vertex is facing. This determines how a face is rendered. If you only used 8 verts for the whole box, then each vert’s normal would be used for all three connected faces making it appear smooth. In most cases this isn’t desired. To make each edge hard each face needs to have it’s own normals and therefor it’s own verts. 4 verts times 6 sides is 24 verts.

The left two boxes in this image might help you visualize this.

1 Like