Procedural Mesh blueprint triangle order

Hi there.

I decided to give procedural mesh generation a go using the Procedural Mesh blueprint component. I am familiar with CG in general and creating meshes from triangle buffers in OpenGL, but I had a question about how UE4’s implementation of procedural meshes works.

When creating a mesh section (using the CreateMeshSection method), does the ordering of the vertex indices in the Triangles input matter? More specifically, does the order of vertices in each triangle (clockwise or counterclockwise) determine the normal of that triangle?

As a follow up, does UE4 use surface normals at all in rendering? If yes, how are they specified and can there be a conflict between vertex and face normals? If no, how are normals determined if you do not supply vertex normals when creating the mesh section?

Thanks in advance,

JT

JT,

Give this answer a try. I had the same problem/question. I am making a cube via blueprint Create Mesh Section. Some of the triangles were not rendering. After some tinkering I decided to try changing the order of the triangles and see what happens. This has impacted the rendering. If I order the vertexes counter clockwise, I can see the triangle if my camera is below the rendered objects. If I move my camera to a location above the triangles, they will no longer render. I will assume that this has to do with the Normals and how they interact and define each of the triangles.

Hope the attached answer helps! Best of luck!

I might have gotten the clockwise vs counter clockwise order mixed. I’m still tinkering with it.

Thanks for replying, I’d totally forgotten about this! I’m messing with procedural meshes again, and you’re absolutely right in that UE4 ProceduralMeshComponent infers the direction of normals from the triangle order. If you’re looking at the triangle face, a clockwise order will make the normal point away from you, and a counter-clockwise order will make the normal point toward you.

If you’re facing two triangles, each with vertices labeled in order from 1 to 3:

       2

1           3

The normal of this triangle will point away from you, so the surface won’t be visible.

       3

1           2

The normal of this triangle will point toward you, so the surface will be visible.

Hopefully anyone who stumbles on this will understand where to go from here now.

1 Like