From 08dec551caab9024ed96a75511406bea99087c12 Mon Sep 17 00:00:00 2001 From: mochi-neko Date: Wed, 9 Aug 2023 17:30:13 +0900 Subject: [PATCH] Scale weight of blend shape --- .../FacialExpressions/Blink/SkinnedMeshEyelidMorpher.cs | 4 ++-- .../FacialExpressions/Emotion/SkinnedMeshEmotionMorpher.cs | 4 ++-- .../FacialExpressions/LipSync/SkinnedMeshLipMorpher.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Mochineko/FacialExpressions/Blink/SkinnedMeshEyelidMorpher.cs b/Assets/Mochineko/FacialExpressions/Blink/SkinnedMeshEyelidMorpher.cs index 7a275f9..3680712 100644 --- a/Assets/Mochineko/FacialExpressions/Blink/SkinnedMeshEyelidMorpher.cs +++ b/Assets/Mochineko/FacialExpressions/Blink/SkinnedMeshEyelidMorpher.cs @@ -29,7 +29,7 @@ public void MorphInto(EyelidSample sample) { if (indexMap.TryGetValue(sample.eyelid, out var index)) { - skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight); + skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight * 100f); } } @@ -37,7 +37,7 @@ public float GetWeightOf(Eyelid eyelid) { if (indexMap.TryGetValue(eyelid, out var index)) { - return skinnedMeshRenderer.GetBlendShapeWeight(index); + return skinnedMeshRenderer.GetBlendShapeWeight(index) / 100f; } else { diff --git a/Assets/Mochineko/FacialExpressions/Emotion/SkinnedMeshEmotionMorpher.cs b/Assets/Mochineko/FacialExpressions/Emotion/SkinnedMeshEmotionMorpher.cs index d9e8cf4..f6018a4 100644 --- a/Assets/Mochineko/FacialExpressions/Emotion/SkinnedMeshEmotionMorpher.cs +++ b/Assets/Mochineko/FacialExpressions/Emotion/SkinnedMeshEmotionMorpher.cs @@ -33,7 +33,7 @@ public void MorphInto(EmotionSample sample) { if (indexMap.TryGetValue(sample.emotion, out var index)) { - skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight); + skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight * 100f); } } @@ -41,7 +41,7 @@ public float GetWeightOf(TEmotion emotion) { if (indexMap.TryGetValue(emotion, out var index)) { - return skinnedMeshRenderer.GetBlendShapeWeight(index); + return skinnedMeshRenderer.GetBlendShapeWeight(index) / 100f; } else { diff --git a/Assets/Mochineko/FacialExpressions/LipSync/SkinnedMeshLipMorpher.cs b/Assets/Mochineko/FacialExpressions/LipSync/SkinnedMeshLipMorpher.cs index ce8857c..0e5b95a 100644 --- a/Assets/Mochineko/FacialExpressions/LipSync/SkinnedMeshLipMorpher.cs +++ b/Assets/Mochineko/FacialExpressions/LipSync/SkinnedMeshLipMorpher.cs @@ -29,7 +29,7 @@ public void MorphInto(LipSample sample) { if (indexMap.TryGetValue(sample.viseme, out var index)) { - skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight); + skinnedMeshRenderer.SetBlendShapeWeight(index, sample.weight * 100f); } else if (sample.viseme is Viseme.sil) { @@ -41,7 +41,7 @@ public float GetWeightOf(Viseme viseme) { if (indexMap.TryGetValue(viseme, out var index)) { - return skinnedMeshRenderer.GetBlendShapeWeight(index); + return skinnedMeshRenderer.GetBlendShapeWeight(index) / 100f; } else {