Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Face Capture Jaw Parameter

Discussion in 'Virtual Production' started by PhineusM, Mar 21, 2022.

  1. PhineusM

    PhineusM

    Joined:
    Apr 14, 2020
    Posts:
    2
    Hello,
    I'm trying to map the "Face Blend Shapes" of the "Face Actor" to a custom Character with different Face Blend Shapes (its a Character from Reallusion Actor Core). I use the Face Mapper for that. The biggest Problem is the "Jaw Open" Shape, because I would have to change the jaw-bone-rotation to get a good result/ an open mouth. The Face Mapper doesnt seem to offer the possibility to drive bone rotations in the character-rig but only blend shapes in a skinned mesh renderer. OK, so I'm trying to to it with a custom script. for that I try to get the current value of the "jaw open" paramter in the face-actor-component and map it to the bone rotation. Could you give me a hint, how to access(read) that paramenter in runtime in a script (so I can use it to drive for example the bone rotation)?
    Thank you very much
     
    akent99 likes this.
  2. ScottSewellUnity

    ScottSewellUnity

    Unity Technologies

    Joined:
    Jan 29, 2020
    Posts:
    20
    Hey!

    We don't expose the face pose directly, it is intended to be accessed though a FaceMapper implementation. That said, we should make it possible to inherit from the DefaultFaceMapper for quick stuff like this, as implementing one from scratch is a fair bit of work.

    In the mean time, reflection can be used as a work around. Here is an example:

    Code (CSharp):
    1. [ExecuteInEditMode]
    2. public class JawFromBlendShape : MonoBehaviour
    3. {
    4.     FaceActor m_Actor;
    5.     PropertyInfo m_GetBlendShapes;
    6.  
    7.     void OnEnable()
    8.     {
    9.         m_Actor = GetComponentInParent<FaceActor>();
    10.         m_GetBlendShapes = typeof(FaceActor).GetProperty("BlendShapes", BindingFlags.Instance | BindingFlags.NonPublic);
    11.     }
    12.  
    13.     void LateUpdate()
    14.     {
    15.         if (m_GetBlendShapes != null)
    16.         {
    17.             var pose = (FaceBlendShapePose)m_GetBlendShapes.GetValue(m_Actor);
    18.          
    19.             // Use pose.JawOpen here...
    20.         }
    21.     }
    22. }
    23.  
    You can modify that script to use set a bone rotation from the pose in LateUpdate.
    I hope this helps!
     
  3. PhineusM

    PhineusM

    Joined:
    Apr 14, 2020
    Posts:
    2
    Thank you, that works!