ADD : 스크립트 업데이트
This commit is contained in:
parent
b6238e41d4
commit
0fcce99b43
@ -16,13 +16,13 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
public bool mirrorMode = false; // 좌우 반전 모드 설정
|
public bool mirrorMode = false; // 좌우 반전 모드 설정
|
||||||
|
|
||||||
[Header("BlendShape 보정")]
|
[Header("BlendShape 보정")]
|
||||||
[Tooltip("세로 방향 BlendShape 보정 비율 (입 벌림, 눈 위아래 등)")]
|
[Tooltip("세로 방향 BlendShape 보정 (0.75 = 세로로 75%로 눌림 → 자동으로 1/0.75 보정)")]
|
||||||
[Range(0.5f, 2.0f)]
|
[Range(0.5f, 1.5f)]
|
||||||
public float verticalScale = 1.28f;
|
public float verticalRatio = 0.75f;
|
||||||
|
|
||||||
[Tooltip("가로 방향 BlendShape 보정 비율 (입 좌우, 볼 등)")]
|
[Tooltip("가로 방향 BlendShape 보정 (1.0 = 보정 없음)")]
|
||||||
[Range(0.5f, 2.0f)]
|
[Range(0.5f, 1.5f)]
|
||||||
public float horizontalScale = 1.0f;
|
public float horizontalRatio = 1.0f;
|
||||||
|
|
||||||
private UdpClient client;
|
private UdpClient client;
|
||||||
private bool StartFlag = true;
|
private bool StartFlag = true;
|
||||||
@ -292,17 +292,28 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 세로/가로 방향에 따른 BlendShape 보정 비율 적용
|
// 세로/가로 방향에 따른 BlendShape 보정 비율 적용
|
||||||
|
// Power 곡선으로 눌린 비율 보정 (0~100 범위 유지)
|
||||||
float ApplyScaleCorrection(string normalizedName, float weight)
|
float ApplyScaleCorrection(string normalizedName, float weight)
|
||||||
{
|
{
|
||||||
|
float ratio = 1.0f;
|
||||||
|
|
||||||
if (VerticalBlendShapes.Contains(normalizedName))
|
if (VerticalBlendShapes.Contains(normalizedName))
|
||||||
{
|
{
|
||||||
return Mathf.Min(weight * verticalScale, 100f);
|
ratio = verticalRatio;
|
||||||
}
|
}
|
||||||
else if (HorizontalBlendShapes.Contains(normalizedName))
|
else if (HorizontalBlendShapes.Contains(normalizedName))
|
||||||
{
|
{
|
||||||
return Mathf.Min(weight * horizontalScale, 100f);
|
ratio = horizontalRatio;
|
||||||
}
|
}
|
||||||
return weight;
|
|
||||||
|
if (Mathf.Approximately(ratio, 1.0f))
|
||||||
|
return weight;
|
||||||
|
|
||||||
|
// ratio가 0.75면 → power = 0.75 → 작은 값이 더 커짐
|
||||||
|
// 예: 입력 25 → 출력 약 5 수준으로 보정
|
||||||
|
float normalized = weight / 100f;
|
||||||
|
float corrected = Mathf.Pow(normalized, ratio);
|
||||||
|
return corrected * 100f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlendShape 이름 정규화 함수
|
// BlendShape 이름 정규화 함수
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user