Skip to content

Commit

Permalink
Fixed normal renormalization being triggered unnecesarily, reported at
Browse files Browse the repository at this point in the history
  • Loading branch information
vpenades committed Jul 25, 2024
1 parent e8d7d5a commit c10acd1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static class VertexPreprocessorLambdas
if (n == Vector3.Zero) return null;

var l = n.Length();
if (l < 0.99f || l > 0.01f) vertex.SetNormal(Vector3.Normalize(n));
if (Math.Abs(l-1) > 0.01f) vertex.SetNormal(Vector3.Normalize(n));
}

if (vertex.TryGetTangent(out Vector4 tw))
Expand All @@ -175,7 +175,7 @@ static class VertexPreprocessorLambdas
if (tw.W < 0) tw.W = -1;

var l = t.Length();
if (l < 0.99f || l > 0.01f) t = Vector3.Normalize(t);
if (Math.Abs(l - 1) > 0.01f) t = Vector3.Normalize(t);

vertex.SetTangent(new Vector4(t, tw.W));
}
Expand Down

0 comments on commit c10acd1

Please sign in to comment.