Search Unity

Blendshapes combined with animation

Discussion in 'Animation' started by Phenomonaut, Apr 28, 2017.

  1. Phenomonaut

    Phenomonaut

    Joined:
    Sep 30, 2012
    Posts:
    61
    I have a human character that I need to transform into a beast during a run animation. I set up the mesh to have a blend shape (aka morph target). Standing still it performs correctly, the verts and bones all move to the desired position (though now I'm questioning if the bones are, as I can't find a way to verify what the position of the blended bones are):



    But when I try to do this during an animation, things go bad:



    I've tried everything I can think of and I can't figure out what's going on with the hands and forearms. Still screenshot:



    And screenshot of meshes and bones in 3ds Max:



    To be clear, this is only one asset in Unity. A mesh of a man with a skeleton and a single run cycle, and that mesh has one blendshape. Theory #1 is that the bones might be inheriting the scaling of their parents, but I can't find any way in Unity to restrict bones to local scaling only.

    Any ideas on what might be happening here, or other ways to diagnose it?
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    OK - this is a simple fix.
    #1 - Don't scale bones in Max. That isn't needed for a full body morph. As long as the base (non morphed) mesh is skinned properly to the base skeleton - bone scaling is not needed - and is the reason for the errors in Unity.

    #2 - Consider researching bone scaling in Unity a bit before proceeding. Bottom line - not advised unless the hierarchy is very simple - not a complete character hierarchy unless very advanced techniques are understood and iterated upon.

    #3 - The morphed character will still animate correctly on the base skeleton - however the animations might look slightly odd because the beast mesh joints (especially in the upper body) are not located where the joint locations are in the base rig. Numerous solutions can solve this. The simple method is to swap out rigs - (scaling bones is not a solution here) - Swapping out the rig from the base rig to a 'beast' rig is normal - and can be masked with FX and camera trickery. However - if the transform happens at the same time an animation is playing - this will be a harder thing to mask. One method is to have 2 rigs - beast rig and base rig animated with the same anim controller and in the scene at all times - but only hide them by turning off the skinned mesh renderer. - Actually - that is probably what I'd do - so the beast rig is always animated with the same animation as the base rig. And the base will have the morph - when he morphs into the beast - swap the rigs so the beast animations will play correctly on the rig with the 'new' edited joint locations. Hide base rig and mesh - until the beast morphs back into the base rig/mesh - at which time the base rig and base mesh are unhid.
     
  3. Phenomonaut

    Phenomonaut

    Joined:
    Sep 30, 2012
    Posts:
    61
    Thanks for giving this some thought, @theANMATOR2b. I'll work my way through your list.

    One quick question to clarify, though. When you say that I'm scaling bones in Unity, do you mean that when using blendshapes, a bone should not blend to a bone with a different scale? Otherwise I don't think I'm scaling bones in Unity or Max. I just have the two skeletons in Max with one set to be a blend shape. Neither are a re-scaled version of the other (though I did try that, with the same results). To put that in other words, do you mean that blending between bones of different sizes in Unity = scaling bones?
     
  4. xieyun2017

    xieyun2017

    Joined:
    Apr 14, 2017
    Posts:
    9
    Hi, RussellFincher. I am running into the same problem. Have you got a solution to fix this?
    My blendshape is turning an adult into a child

    upload_2018-3-24_16-42-6.png upload_2018-3-24_16-42-40.png
     
    bisiyo and jecky111 like this.
  5. DavidPeicho

    DavidPeicho

    Joined:
    Nov 18, 2019
    Posts:
    14
    Hi, your blenshape are modifying the original ratio of length in the bones. That can't work without re-computing the entire skeleton. What you can do is to export the downsized skeleton from Blender, or re-compute it using centroids maybe.
    In my cases, I do the following:
    * Export each blendshape as a separate mesh
    * Each mesh has the skeleton well-taylored, in the proper dimensions regarding the body
    * At runtime, I switch the "Avatar" used (i.e., the bone definition) on the animator.