RecalculateNormals() on Edges & Averaging Normals

Hi!

Ok i spend all day researching and figuring out to code for this but still have same issue. Because i guess i dont know how those normals are calculated.

I have this usual issue on edges after plane mesh construction and RecalculateNormals()

Lets say our planes are 7x7 vertices big, so these are the vertex & normal indexes of them.

I tried to get avarages on edge vertices with different methods but no luck. For blue planes’ edges, which neighbours’ normals do i need to sum? Or am i doing it completely wrong?

These planes are getting position of their vertices from terrain like this.

vertices[i] = matrx.inverse.MultiplyPoint(hit.point + hit.normal * 0.1f);
normals[i] = hit.normal;

Vertices are good but this code also returns wrong normals, so thats why i call RecalculateNormals().

1 Like

Oh damn! I figured it out now. It was because of a stupid mistake.

I also instantiating these planes AT THE SAME TIME. So its interpolating their edge vertices before the neighbour plane instantiated. So calculation was wrong because missing plane normals return (0,1,0) all the time.

Anyways, thanks for reading.

2 Likes