Search Unity

Blender to Unity using rig causes unexpected face-colors

Discussion in 'Asset Importing & Exporting' started by GeXtheGekko, Jun 9, 2017.

  1. GeXtheGekko

    GeXtheGekko

    Joined:
    Jun 23, 2015
    Posts:
    2
    Hi, I've been working on animating a bow in blender using an armature to control the animation. Everything looks fine in blender and also when I view the model/animation using Autodesk's FBX Review tool. When I import it into Unity however, it messes stuff up.

    Importing only the mesh (without the armature) the model looks fine. Importing the mesh with the armature, then disabling the rig in the model import settings inspection view, the model also looks fine (animations won't work this way though). If the rig is enabled however (using the generic animation type), the model's faces don't seem to work correctly anymore (see image). The standard shader is used for all three models, the model has also been UV unwrapped, but I haven't applied any interesting textures in this example.

    unity_rig_error.png

    What I've tried so far:
    - Flip and re-calculate normals in blender
    - Changing the animation type and also setting the root node
    - Changing "Normals & tangents" values under the model tab
    - Adding a texture to the standard shader. Still the same issue, only with a texture...
    - Changing the shader to Unlit/texture or Mobile/Unlit. They all look correct, but shadows aren't applied, so not exactly what im looking for
    - Changing the shader to Mobile/VertexLit. Same type of issue

    Since using the unlit-shaders seem to work, I guess the rig affects the normals for some reason?

    Blender version 2.78
    Unity 5.6.1f1

    Does anyone have any idea of how to fix this?
     
  2. Cygon4

    Cygon4

    Joined:
    Sep 17, 2012
    Posts:
    382
    There is a small check box in the mesh data panel of Blender:

    blender-auto-smooth.png

    It can cause issues just like shown in your screenshot if enabled.

    -

    Another thing you can try is to set all edges in your mesh as smooth (in object mode):

    blender-smooth-shading.png

    And add the "Edge Split" modifier to the mesh instead (by default it splits edges at angles of 30 degrees or higher, but you can also select edges yourself in mesh edit mode and mark them as sharp via Ctrl+E, "Mark Sharp"):

    blender-edge-split-modifier.png
     
  3. Cygon4

    Cygon4

    Joined:
    Sep 17, 2012
    Posts:
    382
    Still weird that enabling/disabling the rig in Unity causes the shading to change.

    Do you have any bones with non-uniform scaling (i.e. scale changes along Z axis but stays the same on X/Y)?

    I assume all mesh transforms are baked to the bind pose?
     
  4. GeXtheGekko

    GeXtheGekko

    Joined:
    Jun 23, 2015
    Posts:
    2
    Smoothing didn't seem to help unfortunately, but thanks for the tip, now I know how to do that! ;)

    All bones have scale 1,1,1, the object itself though didn't. I tried to export it using FBX 6.1 instead of using FBX 7.4, and it alerted me that there was something wrong with the object's scale (0.0025, 0.0025, 0.750 no idea how it ended up like that...) and that this might cause unexpected results, clearly it did... Using ctrl + A to apply the scale seems to have fixed the entire issue! Many thanks for your help Cygon4 :)

    So in short, for anyone with a similar issue, check that the object's scale is 1,1,1. The bones should probably have a scale of 1,1,1 also I assume.
     
  5. Reahreic

    Reahreic

    Joined:
    Mar 23, 2011
    Posts:
    254
    I've encountered this issue too. As a rule I always apply all my transforms so all my objects are scaled 1,1,1 in blender already. Although If I look in Unity one item still comes in as 0.25,0.25,0.25 regardless.

    Edit, just adjusted the parenting of the mesh so that it's a sibling to the armature and not a child, and the issue inverted. Now instead of being hyper metallic, it's hyper flat...