Whinarn / UnityMeshSimplifier

Mesh simplification for Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Seems like normals are inverted (fix in comment)

kalineh opened this issue · comments

I'm not sure if it's our meshes in particular that are setup causing the inverted normals, but they were backwards -- I just changed this to fix locally:

+++ UnityMeshSimplifier/UnityMeshSimplifier-master/Runtime/MeshSimplifier.cs
@@ -1385,7 +1385,7 @@ private void UpdateMesh(int iteration)
                     p20 = p2 - p0;
                     Vector3d.Cross(ref p10, ref p20, out n);
                     n.Normalize();
-                    triangles[i].n = n;
+                    triangles[i].n = -n;

                     sm = new SymmetricMatrix(n.x, n.y, n.z, -Vector3d.Dot(ref n, ref p0));
                     vertices[v0].q += sm;

Hi @kalineh,

You closed this ticket. Does that mean that you were mistaken, or could you please explain why you closed it?

Thanks.