-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Potential fix for RecalculateTangents causing issues with appearace o…
…f non belly body parts
- Loading branch information
Showing
6 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using UnityEngine; | ||
|
||
public static class TangentSolver | ||
{ | ||
//After we do tangent recalculation, replace old tangents where the belly does not touch (to prevent nipples and others from chaning appearance) | ||
// I did this because the Unity recalculate tangents code is super fast, so its easier/quicker to work backward from there | ||
public static Vector4[] UnRecalculateTangents(Vector4[] newTangents, Vector4[] oldTangents, bool[] indexedVerts) | ||
{ | ||
for (var i = 0; i < oldTangents.Length; i++) | ||
{ | ||
//If the vert is not a belly vert, set it back to its old tangent value | ||
if (!indexedVerts[i]) | ||
{ | ||
newTangents[i] = oldTangents[i]; | ||
} | ||
} | ||
|
||
return newTangents; | ||
} | ||
} |