Calculating Normals for UProceduralMeshComponent

I’m hoping someone can take a look at this and tell me which calculation I’m doing wrong or what I’m missing. I’m using ProceduralMesh to try and generate a terrain(hopefully infinite). I’m trying to apply this simple material that blends materials based on their vertexnormal.

Which works fine for a terrain generated using UEs built in landscape generator, but not my procedurally generated mesh. the generated mesh is the solid gray colored object.

I had some issues figuring out normals, and I thought I’d figured it out, but looking at the buffer visualation (World Normal) inside the editor I see my generated mesh not projecting in the way the landscape was. the generated mesh is selected and highlighted in orange.

Finally my code for the mesh generation. I’m sorry for poorly written code in advance.


esh_Part1|674x500].(upload://cnlFoNVQZ6vDNy5fNZcJt5yxRu2.png)

I feel the algorithm is correct but it’s one of my calculations of the mesh data that I’m doing wrong. I think it’s something with my normal calculation, but not entirely sure.

1 Like

What happens if you don’t add the normals or tangents and let the CalculateTangentsForMesh() do it?

I had hoped that would work, but i must have been doing something wrong. Anyways, I solved my own issue and I had done everything correctly and just had not made a steep enough slope to get the slope blending materials.

1 Like