Search Unity

Using Blend Shapes in 4.3

Discussion in 'Animation' started by anubisdeath666, Nov 12, 2013.

  1. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,448
    Yup absolutely! :D
     
  2. ava3

    ava3

    Joined:
    Aug 11, 2013
    Posts:
    5
    ah, that's nice to know
     
  3. graphXyz

    graphXyz

    Joined:
    Mar 24, 2014
    Posts:
    2
    Tested in Lightwave 11.6, same as everyone else, must use FBX 2011 export to see keyed blendshapes.
     
  4. RichardKain

    RichardKain

    Joined:
    Oct 1, 2012
    Posts:
    1,261
    I attempted creating and exporting some blendshapes from Blender, and had no issues. The Blender shapekeys import as BlendShapes for the Skinned Mesh Renderer without any hitches.

    For anyone who's interested, I figured out some slightly less documented functionality for blend-shape related scripting.

    Code (csharp):
    1.  
    2. AnimtionClip freshClip = new AnimationClip();
    3. freshClip.name = "YourAnimName";
    4. AnimationUtility.SetAnimationType(freshClip, ModelImporterAnimationType.Generic);
    5.  
    6. AnimationCurve freshCurve = new AnimationCurve();
    7. freshCurve.AddKey(0.0f, 0.0f);
    8. freshCurve.AddKey(1.0f, 100.0f);
    9.  
    10. freshClip.SetCurve("", typeof(SkinnedMeshRenderer), "blendShape.YourBlendShape",  freshCurve);
    11.  
    12. AssetDatabse.CreateAsset(freshClip, "Assets/Animation/" + freshClip.name + ".anim");
    13. AssetDatabase.SaveAssets();
    14.  
    If you put that little snippet inside a Button conditional in an Editor script, you can use it to create an animation file that is compatible with MecAnim and specific to whatever BlendShape you please. This can be applied to create automatically generated and complex Blend Shape animations.
     
    Kunani likes this.
  5. graphXyz

    graphXyz

    Joined:
    Mar 24, 2014
    Posts:
    2
    Also just tested with 3D Max 2014 w/2014 FBX and it works... Works with both generic and legacy animation types.
     
  6. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    900
    hi any idea if this possible to create blendshape for one mesh in unity directly
     
  7. cerebrate

    cerebrate

    Joined:
    Jan 8, 2010
    Posts:
    261
    Did you get the animation working though?

    If not, I'm thinking your code could be used in a preimporter script to turn specifically named bone animations into animations for the blend shapes, instead of my workaround
     
    Last edited: Apr 19, 2014
  8. forcepusher

    forcepusher

    Joined:
    Jun 25, 2012
    Posts:
    225
    Maya 2015 here. Was pulling my hair trying to get blendshape animation control via model's animation assets while using legacy animation system.
    All i had to do is switch to fbx version 2011.

    Update:
    First successful attempt was just a cube on a joint, didn't work for complex human model with 60 bones and 10 blendshapes.
    Had to switch down to fbx 2010 for it.
    I feel like a Jedi now. May the force be with people who have patience to look for workarounds.
    $085WqbY.png $ZcHxs1s.png
     
    Last edited: Apr 29, 2014
  9. RichardKain

    RichardKain

    Joined:
    Oct 1, 2012
    Posts:
    1,261
    Yes, I did get the animation working, actually! Feel free to use that example however you wish. I'm currently in the process of coding up a more complicated version that takes pre-defined data to create a fairly intricate BlendShape animation with numerous shapes and curves. I'll post more when I've finished the coding and performed some testing.

    I'm loving this new BlendShape feature in 4.3. It is a huge boon to those of us interested in using Unity for animation purposes. Imagine using a fairly simple BlendShape combined with a basic Coroutine to have your characters "breathe" in a dynamic manner.
     
  10. tommyboyd

    tommyboyd

    Joined:
    Nov 11, 2013
    Posts:
    1
    Hi all, came across this thread which was a huge help, and wanted to report my findings. We have a typical human rig in Maya 2015, a combination of skinCluster only (body), as well as skinCluster+blendShape (face, eyelashes). It has facial blend targets that are dialed in directly by the user (smile, blink), as well as set-driven key targets (eyelid shapes that are dialed in as the eyeball moves around). If I bake the blendshape target value sliders onto the blendshape node itself, and then export both the entire geometry and skeletal hierarchies using FBX 2011 with standard presets, it all comes into Unity correctly. If I export with FBX 2014, the blendshape animation does not come in. At the moment we are happy with this, although it sure would be nice if the latest version of FBX works as well as the old one. :)
     
  11. Kunani

    Kunani

    Joined:
    Apr 14, 2013
    Posts:
    16
    Richard, thank you for this: "blendShape.YourBlendShape". Lost some hair over the proper blendShape text to prepend to my blendshape name!
     
  12. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,018
    Just digging into Unity with Blendshapes... very nice work. And what threw me off was the 0-100 thing... would it be possible to just use 0-1? 1 being the full blend shape.
     
    mitch_2 likes this.
  13. mitch_2

    mitch_2

    Joined:
    Jul 16, 2013
    Posts:
    2
    Though the blenshape support is a nice addition, I am quite disappointed with the 0 to 100% range limitation.
    How hard can it be to allow it to go over 100% and under 0%?
     
  14. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,018
    0 to 100 is realistic... if you want exaggerated shapes, then just model it.
     
  15. mitch_2

    mitch_2

    Joined:
    Jul 16, 2013
    Posts:
    2
    Yeah right...
    Realistic means nothing to me :)
    I don't want to model the exagerated shapes :)
    Parameter limits are a bad idea most of the time, typically in animation.
    And it is NOT only to exagerate blendshapes, it allows to have "overshoots" on animation curves without getting "blocking" or "jumpings" during motion so it is not necessary to be too careful managing your animation curves, and you can get some shapes for free (inverted shapes for example).
    It is a very very convenient feature.
    So convenient that it is actually a part of my workflow.
    I use it extensively on feature film or animated series and it saves a lot of work.
    Moreover, in Maya, the interpolation for the factory blendshape deformer is strictly linear, and in some case it can be very obvious with inbetween shapes.
    So I also use a trick with negative weights to get some spline interpolation, the results are clearly better.
    And again, it may save some work because I can be a bit loose when modeling some opposed morphs typically.
     
    Last edited: Aug 26, 2014
  16. jboats

    jboats

    Joined:
    Sep 3, 2014
    Posts:
    1
    Great thread, this was giving me problems because I'm Unity noob and was trying to import a mesh-morph to get my feet wet. Got that part done, now I'm stuck trying to get the mesh-morph to behave as a collision. I can only get the static mesh to work, this is probably a limitation of Unity so I'm wondering if someone has any tricks or scripts for making a morph-mesh into a collision object? thanks!
     
  17. Mike4

    Mike4

    Joined:
    Oct 24, 2013
    Posts:
    92
    Hmm that's what I need. You says Unity could find thes keyframes?
    http://de.tinypic.com/view.php?pic=fnbp1k&s=8#.VAwtchYvzRY

    Could you walk me through as I only get an empty animation in Unity?
    Thanks
     
  18. Sixus1Media

    Sixus1Media

    Joined:
    Aug 26, 2013
    Posts:
    5
    Still fighting with this myself, and have been for sometime. My blend shapes do come into Unity, but the don't keep their keys/animation curves. Still banging my head against the wall on this.... :(
     
  19. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,560
    Necro Bump, did Unity support progressive morpher/Blendshapes??
     
  20. Debashish_bj

    Debashish_bj

    Joined:
    Nov 11, 2014
    Posts:
    14
    hey guys,
    i tried with exporting the rig in FBX 2006, it worked.
    FBX 2011 did not work.
     
  21. kerg

    kerg

    Joined:
    Feb 20, 2013
    Posts:
    25
    Hi!
    I don't really know how things are resolved (or not) now, but as i had the same issue with blendShapes animation not working from maya, i just wanted to say how i resolved this...
    Normally when making a rig i set up controlers or attributes for controlling the blendShapes, for not having to open the blendshape window neither animating directly in the blendshape input node...
    I just tried this time keying directly this blendShape node, instead of having attibutes driving it, and it worked.
    So, direct keys instead of driven connected animations...
    Hope it could help someone...
    (the FBX plugin is 2016 and i didn't needed at all to rename the blendShapes numerically...)
     
  22. DWM08

    DWM08

    Joined:
    Jun 17, 2013
    Posts:
    8
    Figured I'd jump in to help anyone having an issue exporting from Blender like I was. As of Blender 2.75, exporting shapekeys are standard through the binary FBX format.

    HOWEVER, you cannot have an edge-split modifier on the mesh being exported. Unity will not read the shape keys so if you have specific hard edges in your model you'll have to figure out a different way to deal with defining hard/smooth edges.
     
  23. MamoruK

    MamoruK

    Joined:
    Apr 19, 2014
    Posts:
    4
    Alright guys I'm having this issue as well, and i can't seem to figure it out, I've used the previous versions of the FBX exporter everything and i can't get my blendshapes to export into my fbx file. I'm using maya 2015 and i don't know what's going on and I've got to get this stuff to a client.

    Can someone who does this successfully on a constant basis make a video or something on what they do?
     
    Last edited: Nov 6, 2015
  24. Marnie

    Marnie

    Joined:
    Mar 21, 2013
    Posts:
    2
    Hey Everyone,

    Earlier this year I had trouble exporting animation from Maya 2011 using FBX exporter 11.3 to Unity 5.2.

    It seemed that due to my use of Nurb Controls in my rig the FBX exporter was not baking the animation despite the setting being correct. I'd always had this work previously in Maya 2011 so I can only assume this is a problem with the FBX version.

    To work around I had to manually bake the animation using 'Bake Simulation' first and then export. Which is annoying when I didn't need to previously. Anyone experienced this? Am I going to have to go back to an older version?

    Now that I'm trying Blendshapes (without any joint animation alongside for now) I've actually had the opposite problem of some of you...I can import my 'character' and 'animation' and then apply this animation to my character mesh. However I cannot get access to any Blendshapes using the 'Skinned Mesh Renderer' Component in the Inspector as you have.

    Anyone any ideas why? Do I have to use Joints and Skin the mesh to see Blendshapes in the 'Skinned Mesh Renderer'?

    ALSO I have a problem where- while I can see some animation movement in Unity, its not using the full range of the Blendshape (if that makes sense?) in Maya each of my Blendshapes are made using two poses each. The animation exported only goes to the first pose of the blendshape and not the full extent like it does in Maya.
     
  25. BowesAcademy

    BowesAcademy

    Joined:
    Feb 18, 2014
    Posts:
    133
    Does anyone know how to import Blender shape key drivers into Unity? It would be awesome if the position of the bones determined the value of the shape key. I know someone posted a script that does something like this before, but I need some more information about how to implement it.
     
  26. VijetaR

    VijetaR

    Joined:
    Mar 11, 2021
    Posts:
    2
    This link is not working ,
    I rigged character from mixamo and create blends in maya then export it in .fbx format.
    before export everything is fine and good. but after export when i ON blendshapes ,
    The head moves out of its place,
    This is happening in both Maya and Unity.
     
unityunity