Skip to content

Commit

Permalink
Merge pull request #448 from anatawa12/fix-merge-bone-will-break-normal
Browse files Browse the repository at this point in the history
fix: MergeBone will break normal and tangent
  • Loading branch information
anatawa12 authored Sep 11, 2023
2 parents fc56c25 + 40101fe commit 16d879d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- MergeBone will break Normal and Tangent `#448`

### Security

Expand Down
3 changes: 3 additions & 0 deletions Editor/Processors/MergeBoneProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ private void DoBoneMap2(MeshInfo2 meshInfo2, Dictionary<Transform, Transform> me
var transBindPose = finalBone.Bindpose.inverse * mergedOldBindPose;

vertex.Position = transBindPose.MultiplyPoint3x4(vertex.Position);
vertex.Normal = transBindPose.MultiplyPoint3x3(vertex.Normal);
var tangentVec3 = transBindPose.MultiplyPoint3x3(vertex.Tangent);
vertex.Tangent = new Vector4(tangentVec3.x, tangentVec3.y, tangentVec3.z);
foreach (var frames in vertex.BlendShapes.Values)
{
for (var i = 0; i < frames.Count; i++)
Expand Down

0 comments on commit 16d879d

Please sign in to comment.