Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Blender, characters and the Y-up axis ...?

Discussion in 'Asset Importing & Exporting' started by the_motionblur, Apr 18, 2017.

  1. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    Lately I've been toying around with the idea of getting my personal projects over to Blender for animation again.

    Blender of course has a z-up coordinate system so models are rotated on import or have an added null as corractional transform. Mostly I've seen the method with the correctional null or a simple rotate geometry in Blender itself (if possible).

    I'm asking mostly character specific. For any static geometry I would not have problems with a rotation correction. It doesn't feel right but with static geometry ... sure. Fine. What about characters and things like root motion, though?

    So with all the current animation systems in Mecanim in place - how good does this still hold up?
    Does anyone here have experience they can share on how good this system works, especially later in production?
    Are there problems that you run into with Unity that make things difficult or problematic with Blender's FBX export on skinned characters specifically?

    Or if you are super successful with it - how many problems did you have to figure out before everything went smooth?
     
    Last edited: Apr 18, 2017
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    When I export fbx files from Blender, I chose "Z forward" (instead of -Zforward), and make sure Y is up. Then everything works out, and I don't have to flip or fix anything. I don't animate in Blender, but I do export rigged models for use in UMA, and it works fine.
     
    the_motionblur likes this.
  3. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    Thanks :)
    I've started working through Nathan Vegdahl's Humane Rigging course over the last few days. Let's see how it goes. :D
     
  4. Cygon4

    Cygon4

    Joined:
    Sep 17, 2012
    Posts:
    382
    I'm doing animation-heavy projects completely in Blender.

    I haven't run into any problems with Z-up vs. Y-up so far. Skinned meshes are imported into Unity with the correct orientation and animations are working fine. The local bone axes are often pretty random, but so long as animations play, ¯\_(ツ)_/¯

    I'm not using root motion (and the model preview does show the model on its side when in the inspector, animation tab, motion group I assign my model's root bone to the "Root Motion Node," but I don't know if this is a blocker).

    Exporting by hand got tedious really fast. Especially if I wanted to export only some objects in the scene (like, not all the WGT_XXX meshes from Rigify) and had to select them one-by-one each time to use the 'Selected Objects Only' option. So I wrote a Python script (actor-export.py) that exports only the objects I want with the correct settings every time. I run it via a shell script:

    Code (CSharp):
    1. #!/bin/sh
    2.  
    3. if [ ./.Models/Spotlight.blend -nt ./Spotlight.fbx ]
    4. then
    5.   blender \
    6.     ./.Models/Spotlight.blend \
    7.     --python ../../../../Blender/actor-export.py \
    8.     --background \
    9.     -- \
    10.     ./Spotlight.fbx \
    11.     Mounting \
    12.     Case \
    13.     Shades
    14. fi
    To manage animations, I used Blender's library linking feature. Like, I have "Character.blend" and "ClimbingAnimations.bkend", "FightingAnimations.blend" etc. linking to that file without duplicating the meshes/rigs. Also very useful to created paired animations (i.e. "Character.blend" + "Horse.blend" linked into "RidingAnimations.blend").

    Exporting animations with linked+proxied armatures kept breaking across different Blender versions, so I wrote a script that fixes it once and for all: its opens the original "Character.blend," appends (in memory) all animations from the animation .blend file, creats a dummy mesh to export, then exports only the dummy mesh + animations, finally closes without saving (animation-export.py) :)

    Code (CSharp):
    1. #!/bin/sh
    2.  
    3. if [ ./.Models/RidingAnimations.blend -nt ./RidingAnimations.Character.fbx ]
    4. then
    5.   blender \
    6.     ../../Actors/Character/.Models/Character.Rigify.blend \
    7.     --background \
    8.     --enable-autoexec \
    9.     --python ../../../Blender/animation-export.py \
    10.     -- \
    11.     ./.Models/RidingAnimations.blend \
    12.     *-Character \
    13.     ./RidingAnimations.Character.fbx
    14. fi
    With the scripts in place, I'm very happy with the Blender workflow. The edit-export-test cycle is extremely fast (since I only export/import the 5 or so animations in an animation library).
     
    Last edited: Jul 20, 2017
    the_motionblur likes this.