Skip to content

Commit

Permalink
fixed material duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCake committed May 4, 2020
1 parent 5650428 commit 2e2d266
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Code/DQ skinning/DualQuaternionSkinner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/// Make sure that all materials of the animated object are using shader \"<b>MadCake/Material/Standard hacked for DQ skinning</b>\"
/// </summary>
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(SkinnedMeshRenderer))]
public class DualQuaternionSkinner : MonoBehaviour
{
/// <summary>
Expand Down Expand Up @@ -347,10 +346,9 @@ void GrabMeshFromSkinnedMeshRenderer()
this.arrBufMorphDeltas[i].SetData(deltaVertInfos);
}

Material[] materials = new Material[this.smr.materials.Length];
for (int i = 0; i < this.smr.materials.Length; i++)
Material[] materials = this.smr.sharedMaterials;
for (int i = 0; i < materials.Length; i++)
{
materials[i] = new Material(this.smr.materials[i]);
materials[i].SetInt("_DoSkinning", 1);
}
this.mr.materials = materials;
Expand Down

0 comments on commit 2e2d266

Please sign in to comment.