Remove : iFacialMocap BlendShape 보정 기능 제거
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
92509cdd22
commit
92de9801d8
@ -14,16 +14,6 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
public bool gameStartWithConnect = true;
|
public bool gameStartWithConnect = true;
|
||||||
public string iOS_IPAddress = "255.255.255.255";
|
public string iOS_IPAddress = "255.255.255.255";
|
||||||
public bool mirrorMode = false; // 좌우 반전 모드 설정
|
public bool mirrorMode = false; // 좌우 반전 모드 설정
|
||||||
|
|
||||||
[Header("BlendShape 보정")]
|
|
||||||
[Tooltip("세로 방향 BlendShape 보정 (0.75 = 세로로 75%로 눌림 → 자동으로 1/0.75 보정)")]
|
|
||||||
[Range(0.5f, 1.5f)]
|
|
||||||
public float verticalRatio = 0.75f;
|
|
||||||
|
|
||||||
[Tooltip("가로 방향 BlendShape 보정 (1.0 = 보정 없음)")]
|
|
||||||
[Range(0.5f, 1.5f)]
|
|
||||||
public float horizontalRatio = 1.0f;
|
|
||||||
|
|
||||||
private UdpClient client;
|
private UdpClient client;
|
||||||
private bool StartFlag = true;
|
private bool StartFlag = true;
|
||||||
|
|
||||||
@ -50,33 +40,6 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
private readonly char[] splitHash = new char[] { '#' };
|
private readonly char[] splitHash = new char[] { '#' };
|
||||||
private readonly char[] splitComma = new char[] { ',' };
|
private readonly char[] splitComma = new char[] { ',' };
|
||||||
|
|
||||||
// 세로 방향 BlendShape (위아래 움직임) - verticalScale 적용
|
|
||||||
private static readonly HashSet<string> VerticalBlendShapes = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
|
|
||||||
// 입 세로
|
|
||||||
"jawopen", "mouthclose", "mouthfunnel", "mouthpucker",
|
|
||||||
// 눈 위아래
|
|
||||||
"eyelookupleft", "eyelookupright", "eyelookdownleft", "eyelookdownright",
|
|
||||||
"eyewideleft", "eyewideright", "eyesquintleft", "eyesquintright",
|
|
||||||
"eyeblinkleft", "eyeblinkright",
|
|
||||||
// 눈썹 위아래
|
|
||||||
"browinnerup", "browdownleft", "browdownright", "browouterupright", "browouterupleft"
|
|
||||||
};
|
|
||||||
|
|
||||||
// 가로 방향 BlendShape (좌우 움직임) - horizontalScale 적용
|
|
||||||
private static readonly HashSet<string> HorizontalBlendShapes = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
|
|
||||||
// 입 좌우
|
|
||||||
"mouthsmileleft", "mouthsmileright", "mouthfrownleft", "mouthfrownright",
|
|
||||||
"mouthdimpleleft", "mouthdimpleright", "mouthstretchleft", "mouthstretchright",
|
|
||||||
"mouthpressleft", "mouthpressright", "mouthlowerdownleft", "mouthlowerdownright",
|
|
||||||
"mouthupperupleft", "mouthupperupright",
|
|
||||||
"mouthleft", "mouthright",
|
|
||||||
// 눈 좌우
|
|
||||||
"eyelookinleft", "eyelookinright", "eyelookoutleft", "eyelookoutright",
|
|
||||||
// 볼/코
|
|
||||||
"cheekpuff", "cheeksquintleft", "cheeksquintright",
|
|
||||||
"nosesneerleft", "nosesneerright"
|
|
||||||
};
|
|
||||||
|
|
||||||
// Mirror mode용 정적 매핑 테이블
|
// Mirror mode용 정적 매핑 테이블
|
||||||
private static readonly Dictionary<string, string> EyeMirrorMap = new Dictionary<string, string>() {
|
private static readonly Dictionary<string, string> EyeMirrorMap = new Dictionary<string, string>() {
|
||||||
{"eyelookupleft", "EyeLookUpRight"},
|
{"eyelookupleft", "EyeLookUpRight"},
|
||||||
@ -275,9 +238,6 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
// 정규화된 이름으로 캐시 검색
|
// 정규화된 이름으로 캐시 검색
|
||||||
string normalizedName = NormalizeBlendShapeName(shapeName).ToLowerInvariant();
|
string normalizedName = NormalizeBlendShapeName(shapeName).ToLowerInvariant();
|
||||||
|
|
||||||
// 세로/가로 방향에 따라 보정 비율 적용
|
|
||||||
weight = ApplyScaleCorrection(normalizedName, weight);
|
|
||||||
|
|
||||||
if (blendShapeCache.TryGetValue(normalizedName, out List<BlendShapeMapping> mappings))
|
if (blendShapeCache.TryGetValue(normalizedName, out List<BlendShapeMapping> mappings))
|
||||||
{
|
{
|
||||||
// 캐시에서 찾은 모든 매핑에 대해 weight 설정
|
// 캐시에서 찾은 모든 매핑에 대해 weight 설정
|
||||||
@ -291,31 +251,6 @@ public class UnityRecieve_FACEMOTION3D_and_iFacialMocap : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 세로/가로 방향에 따른 BlendShape 보정 비율 적용
|
|
||||||
// Power 곡선으로 눌린 비율 보정 (0~100 범위 유지)
|
|
||||||
float ApplyScaleCorrection(string normalizedName, float weight)
|
|
||||||
{
|
|
||||||
float ratio = 1.0f;
|
|
||||||
|
|
||||||
if (VerticalBlendShapes.Contains(normalizedName))
|
|
||||||
{
|
|
||||||
ratio = verticalRatio;
|
|
||||||
}
|
|
||||||
else if (HorizontalBlendShapes.Contains(normalizedName))
|
|
||||||
{
|
|
||||||
ratio = horizontalRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 이름 정규화 함수
|
||||||
string NormalizeBlendShapeName(string name)
|
string NormalizeBlendShapeName(string name)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user