Search Unity

Blender Model Being Imported Weird?

Discussion in 'Editor & General Support' started by WyattClarky, Nov 28, 2021.

  1. WyattClarky

    WyattClarky

    Joined:
    Oct 26, 2020
    Posts:
    5
    Hi,
    When I import a model I made in blender to unity it gets all messed up and looks like this?
    Is there anything someone can do to help me?
    All my other fbx models work perfectly fine...
    upload_2021-11-29_0-15-16.png
    Thankyou.
     
    ostapvovkohon likes this.
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,434
    What does it look like in Blender?

    Also in Blender, try using "Recalculate Normals - Outside" and "Object > Apply > Rotation and Scale" on each mesh before you export. (Back up your current .blend first.) Many Unity shaders will skip rendering polygons that are facing the wrong way, while Blender will show it. And sometimes non-simple transforms can distort meshes; Unity does not support transforms that are not purely rotation+scale+translation.
     
    ostapvovkohon likes this.
  3. WyattClarky

    WyattClarky

    Joined:
    Oct 26, 2020
    Posts:
    5
    it look perfectly fine in blender
    thankyou i will try to do that in blender
    what you suggested didn't work?
    i think it has something to do with backface culling in unity
     

    Attached Files:

    • Bob.PNG
      Bob.PNG
      File size:
      135.8 KB
      Views:
      328
    Last edited: Nov 29, 2021
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,702
    If Blender can't reliably discern inside / outside it will fail.

    Very likely. Turn on Backface culling in Blender3D and see what it looks like, then flip any normals that are backwards. I usually work with this mode always ON so I can immediately see errors. Otherwise the only indication is potentially-incorrect lighting.

    backface_culling.png
     
    Melanzue and MuskyMarauder like this.
  5. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,434
    Yeah, it's not easy to see flipped normals sometimes in Blender, but that's the most likely cause.



    In the drawing above I accidentally flipped one of the polygon's normals so it faces into the cube. Using the three steps, I can find the polygons which have flipped normals. You can see the little blue lines facing outward on five faces, and inward on one; I added a yellow arrow to help you see the difference here. On angular shapes in Blender you really can't tell easily, but on curvy shapes you will spot bad lighting artifacts even in Blender.

    Once you find the polygons that are flipped, you can individually Flip Normals or you can try selecting the whole mesh and Recalculate Normals - Outside. This usually fixes things if you have good geometry.

    Kurt-Dekker's method should show you meshes like Unity will typically render them. I showed my method to help identify and correct the geometry.
     
  6. WyattClarky

    WyattClarky

    Joined:
    Oct 26, 2020
    Posts:
    5
    This method worked and now i can see that all of the normals are facing outwards in blender, but when i import the asset to unity, it still acts the same but with different sides?
    upload_2021-11-29_14-59-29.png
     
  7. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,434
    Looks like you still have about half flipped. Just a different set from before. There may be some duplicate vertices or faces confusing the Recalculate Normals routine. If you have a place you can post a small .blend file I can swap it out for you.
     
    MuskyMarauder likes this.
  8. WyattClarky

    WyattClarky

    Joined:
    Oct 26, 2020
    Posts:
    5
    that would be great thankyou so much, where can i send it to you?
     
  9. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,434
    Use Dropbox or Google Drive or something like that, and send a private message here (click my name, use Start a Conversation) to give me the URL.
     
  10. WyattClarky

    WyattClarky

    Joined:
    Oct 26, 2020
    Posts:
    5
    I sent you the file. if you still want to thankyou so much
     
  11. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,434
    Okay, that was the simplest Blend file in the world, and your mesh normals looked just fine. Yet I reproduced your results when exporting to FBX and importing into Unity. You weren't going crazy.

    I also checked in the Numbers panel in Blender that your mesh had an applied scale matrix as it should be. Otherwise, the transform into FBX and Unity would get confused, and if any 1 or 3 of those axes were a negative scale, then you would see a lot of flipped normals in the conversion. But that wasn't the case, everything was of 1.0, 1.0, 1.0 on the mesh. Curiouser and curiouser.

    Aha.

    The mesh is a child object of the armature, and you're exporting both armature and mesh into FBX and Unity. (If you're just importing directly to Unity, it's really going through a hidden FBX intermediary format, you just don't see it.) And your Armature had a flipped applied scale matrix, with the X axis negative. There's the root cause, so to speak. With a negative X axis on the armature, the FBX export will apply those transforms to the mesh, thus flipping all the normals inward.



    To correct your situation, select the Armature object, and use Object > Apply > Rotation and Scale. This sets the armature scale matrix to 1.0, 1.0, 1.0, and then edits all the bone positions of the armature to match their original effective positions, so it is potentially risky to do this on a huge complex rigged armature. In your case it had no ill effects. Best to ensure these things are all applied and at a 1x scale before more complicated rigging work.

    Here are the FBX exporter settings I used when testing. The only gotcha setting really is to ensure you're not using Apply Settings "All Local" if you have any pieces of your character away from the origin. I always use "FBX All" and it is pretty reliable. I am surprised that your text character smiley face actually converted properly (through the dubious "other" category in the export settings). I suggest you convert this smiley to a mesh in Blender just to be sure it always comes through correctly and no font mismatch issues create a new surprise.