- Home /
Are normals from Mesh.RecalculateNormals() normalized?
Hello there,
I'm creating procedurally generated meshes in form of tiles. I want to fix the seam happening, when placing two meshes next to each other. for this I want to take the two overlapping vertices of both meshes and do basically the following calculation: (vertex1Normal + vertex2Normal) / 2
The normals of both meshes are filled by the RecalculateNormals() function provided by the API. so vertex1Normal would be the alias for mesh1.normals[index] after mesh1.RecalculateNormals() happened and vertex2Normal would be the alias for mesh2.normals[otherIndex] after mesh2.RecalculateNormals() happened.
Now my question is: If I understood correctly vertex1Normal and vertex2Normal have to be normalized for the calculation to work. And I would like to know, if the normals provided by Mesh.RecalculateNormals() are normalized, or if I have to normalize them myself (Which would probably mean, that I have to normalize all normals on the entire mesh? Correct?)
Thank you in advance
Answer by Bunny83 · Apr 30, 2020 at 02:11 PM
Yes the normals you get from RecalculateNormals are normalized. Keep in mind that you have to re-normalize your result as well after your combining. That's because the resulting length of your average sum is cos(a/2)
where "a" is the angle between your two normals. So make sure you normalize your result
var normal = (n1 + n2).normalized;
Of course when you normalize the normal the division by 2 is not necessary / irrelevant.
Ah awesome! Thank you very much for the tip! I would have totaly forgot! I'm studying Informatiks/$$anonymous$$ath in Uni and I still have so much respect to individuals who see this kind of stuff right away... Then I will normalize it in s$$anonymous$$d of dividing by 2.
Your answer
Follow this Question
Related Questions
Procedural mesh's normals are reversed (Solved) 2 Answers
How do I combine normals on procedural mesh with multiple tiles? 2 Answers
Unity Mesh Rendering Issue 0 Answers
Holes in procedural mesh 0 Answers