Created
August 8, 2025 09:45
-
-
Save srcnalt/fcf871e17056d5d76e851123bed6d856 to your computer and use it in GitHub Desktop.
CC4 visemes to OVR mapping in Unity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CC4 visemes to OVR mapping in Unity | |
using UnityEngine; | |
[RequireComponent(typeof(OVRLipSyncContextBase))] | |
public class VisemeMapper : MonoBehaviour | |
{ | |
public SkinnedMeshRenderer mesh; | |
public OVRLipSyncContextMorphTarget context; | |
// Match the indices from Oculus visemes to your CC4 blendshape indices | |
private readonly int[] indices = new int[15]; | |
private void Awake() | |
{ | |
// Map Oculus visemes (0–14) to CC4 blendshape indices | |
indices[0] = mesh.sharedMesh.GetBlendShapeIndex("None"); // sil | |
indices[1] = mesh.sharedMesh.GetBlendShapeIndex("B_M_P"); // PP | |
indices[2] = mesh.sharedMesh.GetBlendShapeIndex("F_V"); // FF | |
indices[3] = mesh.sharedMesh.GetBlendShapeIndex("TH"); // TH | |
indices[4] = mesh.sharedMesh.GetBlendShapeIndex("T_L_D_N"); // DD | |
indices[5] = mesh.sharedMesh.GetBlendShapeIndex("K_G_H_NG"); // kk | |
indices[6] = mesh.sharedMesh.GetBlendShapeIndex("Ch_J"); // CH | |
indices[7] = mesh.sharedMesh.GetBlendShapeIndex("S_Z"); // SS | |
indices[8] = mesh.sharedMesh.GetBlendShapeIndex("T_L_D_N"); // nn | |
indices[9] = mesh.sharedMesh.GetBlendShapeIndex("R"); // RR | |
indices[10] = mesh.sharedMesh.GetBlendShapeIndex("Ah"); // aa | |
indices[11] = mesh.sharedMesh.GetBlendShapeIndex("AE"); // E | |
indices[12] = mesh.sharedMesh.GetBlendShapeIndex("IH"); // ih | |
indices[13] = mesh.sharedMesh.GetBlendShapeIndex("Oh"); // oh | |
indices[14] = mesh.sharedMesh.GetBlendShapeIndex("W_OO"); // ou | |
// Set the indices in OVR target | |
context.visemeToBlendTargets = indices; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment