@@ -171,8 +171,23 @@ private void UpdateExpression(float[] pShape)
171171 SetParam ( pShape , BlendShape . Index . MouthUpperUp_R , UnifiedExpressions . MouthUpperUpRight ) ;
172172 SetParam ( pShape , BlendShape . Index . MouthLowerDown_L , UnifiedExpressions . MouthLowerDownLeft ) ;
173173 SetParam ( pShape , BlendShape . Index . MouthLowerDown_R , UnifiedExpressions . MouthLowerDownRight ) ;
174- SetParam ( pShape , BlendShape . Index . MouthFrown_L , UnifiedExpressions . MouthFrownLeft ) ;
175- SetParam ( pShape , BlendShape . Index . MouthFrown_R , UnifiedExpressions . MouthFrownRight ) ;
174+
175+ var mouthFrownLeft = pShape [ ( int ) BlendShape . Index . MouthFrown_L ] ;
176+ SetParam ( pShape [ ( int ) BlendShape . Index . JawOpen ] > 0.1f
177+ ? mouthFrownLeft / 2f
178+ : pShape [ ( int ) BlendShape . Index . MouthRollLower ] > 0.2f
179+ ? mouthFrownLeft * 2.5f + pShape [ ( int ) BlendShape . Index . MouthRollLower ]
180+ : mouthFrownLeft ,
181+ UnifiedExpressions . MouthFrownLeft ) ;
182+
183+ var mouthFrownRight = pShape [ ( int ) BlendShape . Index . MouthFrown_R ] ;
184+ SetParam ( pShape [ ( int ) BlendShape . Index . JawOpen ] > 0.1f
185+ ? mouthFrownRight / 2f
186+ : pShape [ ( int ) BlendShape . Index . MouthRollLower ] > 0.2f
187+ ? mouthFrownRight * 2.5f + pShape [ ( int ) BlendShape . Index . MouthRollLower ]
188+ : mouthFrownRight ,
189+ UnifiedExpressions . MouthFrownRight ) ;
190+
176191 SetParam ( pShape , BlendShape . Index . MouthDimple_L , UnifiedExpressions . MouthDimpleLeft ) ;
177192 SetParam ( pShape , BlendShape . Index . MouthDimple_R , UnifiedExpressions . MouthDimpleRight ) ;
178193 SetParam ( pShape , BlendShape . Index . MouthLeft , UnifiedExpressions . MouthUpperLeft ) ;
@@ -183,19 +198,56 @@ private void UpdateExpression(float[] pShape)
183198 SetParam ( pShape , BlendShape . Index . MouthPress_R , UnifiedExpressions . MouthPressRight ) ;
184199 SetParam ( pShape , BlendShape . Index . MouthShrugLower , UnifiedExpressions . MouthRaiserLower ) ;
185200 SetParam ( pShape , BlendShape . Index . MouthShrugUpper , UnifiedExpressions . MouthRaiserUpper ) ;
186- SetParam ( pShape , BlendShape . Index . MouthSmile_L , UnifiedExpressions . MouthCornerPullLeft ) ;
187- SetParam ( pShape , BlendShape . Index . MouthSmile_L , UnifiedExpressions . MouthCornerSlantLeft ) ;
188- SetParam ( pShape , BlendShape . Index . MouthSmile_R , UnifiedExpressions . MouthCornerPullRight ) ;
189- SetParam ( pShape , BlendShape . Index . MouthSmile_R , UnifiedExpressions . MouthCornerSlantRight ) ;
201+
202+ var mouthSmileLeft = pShape [ ( int ) BlendShape . Index . MouthSmile_L ] -
203+ pShape [ ( int ) BlendShape . Index . MouthRollLower ] ;
204+ SetParam ( pShape [ ( int ) BlendShape . Index . MouthRollLower ] < 0.2f
205+ ? mouthSmileLeft
206+ : 0f ,
207+ UnifiedExpressions . MouthCornerPullLeft ) ;
208+ SetParam ( pShape [ ( int ) BlendShape . Index . MouthRollLower ] < 0.2f
209+ ? mouthSmileLeft - pShape [ ( int ) BlendShape . Index . MouthRollLower ]
210+ : 0f ,
211+ UnifiedExpressions . MouthCornerSlantLeft ) ;
212+
213+ var mouthSmileRight = pShape [ ( int ) BlendShape . Index . MouthSmile_R ] -
214+ pShape [ ( int ) BlendShape . Index . MouthRollLower ] ;
215+ SetParam ( pShape [ ( int ) BlendShape . Index . MouthRollLower ] < 0.2f
216+ ? mouthSmileRight
217+ : 0f ,
218+ UnifiedExpressions . MouthCornerPullRight ) ;
219+ SetParam ( pShape [ ( int ) BlendShape . Index . MouthRollLower ] < 0.2f
220+ ? mouthSmileRight
221+ : 0f ,
222+ UnifiedExpressions . MouthCornerSlantRight ) ;
223+
190224 SetParam ( pShape , BlendShape . Index . MouthStretch_L , UnifiedExpressions . MouthStretchLeft ) ;
191225 SetParam ( pShape , BlendShape . Index . MouthStretch_R , UnifiedExpressions . MouthStretchRight ) ;
192226 #endregion
193227
194228 #region Lip
195- SetParam ( pShape , BlendShape . Index . MouthFunnel , UnifiedExpressions . LipFunnelUpperLeft ) ;
196- SetParam ( pShape , BlendShape . Index . MouthFunnel , UnifiedExpressions . LipFunnelUpperRight ) ;
197- SetParam ( pShape , BlendShape . Index . MouthFunnel , UnifiedExpressions . LipFunnelLowerLeft ) ;
198- SetParam ( pShape , BlendShape . Index . MouthFunnel , UnifiedExpressions . LipFunnelLowerRight ) ;
229+ var isFunnelLeft = pShape [ ( int ) BlendShape . Index . MouthPucker ] > 0.3f &&
230+ pShape [ ( int ) BlendShape . Index . MouthPress_L ] < 0.2f ;
231+ var isFunnelRight = pShape [ ( int ) BlendShape . Index . MouthPucker ] > 0.3f &&
232+ pShape [ ( int ) BlendShape . Index . MouthPress_R ] < 0.2f ;
233+ var mouthFunnelFixed = pShape [ ( int ) BlendShape . Index . MouthPucker ] ;
234+ SetParam ( isFunnelLeft
235+ ? mouthFunnelFixed
236+ : pShape [ ( int ) BlendShape . Index . MouthFunnel ] ,
237+ UnifiedExpressions . LipFunnelUpperLeft ) ;
238+ SetParam ( isFunnelRight
239+ ? mouthFunnelFixed
240+ : pShape [ ( int ) BlendShape . Index . MouthFunnel ] ,
241+ UnifiedExpressions . LipFunnelUpperRight ) ;
242+ SetParam ( isFunnelLeft
243+ ? mouthFunnelFixed
244+ : pShape [ ( int ) BlendShape . Index . MouthFunnel ] ,
245+ UnifiedExpressions . LipFunnelLowerLeft ) ;
246+ SetParam ( isFunnelRight
247+ ? mouthFunnelFixed
248+ : pShape [ ( int ) BlendShape . Index . MouthFunnel ] ,
249+ UnifiedExpressions . LipFunnelLowerRight ) ;
250+
199251 SetParam ( pShape , BlendShape . Index . MouthPucker , UnifiedExpressions . LipPuckerUpperLeft ) ;
200252 SetParam ( pShape , BlendShape . Index . MouthPucker , UnifiedExpressions . LipPuckerUpperRight ) ;
201253 SetParam ( pShape , BlendShape . Index . MouthPucker , UnifiedExpressions . LipPuckerLowerLeft ) ;
0 commit comments