Search Unity

Blender to unity mesh lighting broken during animation

Discussion in 'Asset Importing & Exporting' started by Phelan-Simpson, May 1, 2016.

  1. Phelan-Simpson

    Phelan-Simpson

    Joined:
    Jan 1, 2014
    Posts:
    31
    Hey all,

    I have been working on this issue without any success after thoroughly searching forums and Unity answers. My animations work fine with an editor, Blender or Maya. I use the FBX 7.4 binary export in blender. When I import this model, which is uv unwrapped, with animations into Unity, the mesh lights very weirdly. I do not have a normal map applied to this model, so I think it must be something with the mesh's faces not updating their direction to match the new pose. I do not understand what the problem is. Does anyone know why this is happening?

    Screens of issue:

    1.JPG 2.JPG 3.JPG


    Thanks,
     
    Last edited: May 2, 2016
  2. Fab4

    Fab4

    Joined:
    Sep 30, 2012
    Posts:
    114
    actually the Normal maps are normalized, which makes them valid for each direction in world space for your mesh. In other words they don't update.
    they have to be designt to be adequate for all poses you need.
    I think the axillary is crimped in the baking pose, which makes it look strange in an streched pose
     
  3. Phelan-Simpson

    Phelan-Simpson

    Joined:
    Jan 1, 2014
    Posts:
    31
    Thanks for the reply,

    Sorry I think I worded the question wrong. I don't have a normal map applied, these are the faces of the model that have such weird lighting. Before in Unity 4 there was a skinned normals option in the skinned mesh renderer, that is gone now. I read the unity documentation, and it says the on mobile it uses the cpu to skin the mesh which causes the mesh to not have normalized tangents/normals. Could something like this be causing the lighting errors? It says that if you are using surface shaders than it is handled automatically by Unity. I am currently have my project set to desktop build and I am using the standard shader.

    I know that in facial animation that you can update tangents to properly light the model when blendshapes are being used in conjunction with the rig. Or am I not understanding that correctly. Could I do something like this here?

    Thanks,
     
  4. _GimbalLock_

    _GimbalLock_

    Joined:
    Feb 26, 2013
    Posts:
    137
    2 questions. Are you referring to the dark shadowing under the entire arm. Or the section geometry where the armpit is?

    To me the deformation at the armpit looks off and the weights need adjusted. Keep in mind Unity doesn't allow for more than 4 influences per vertex. So if you have more they will be pruned and depending on how that process goes, it can lead to deformations that don't match what you saw in Maya
     
  5. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    @Phelan Simpson
    This could be the result of Unity's 4 bone influence per vertex on skinned meshes. Unity only allows for up to 4 bones to be assigned to one vertex. By default I believe the setting is set to 4 - but it might be set lower which is causing the odd skinning artifact. Check the vertex bone influence first.
    If the setting is set to 4 bones - the vertex influence in the 3D package might be set higher which would result in a smoother look. This can be tested by limiting the number of influence bones per vertex to 4 in blender/maya and viewing the resulting animation after the influence is changed.

    Possibly the arm pit area (lower part) is being influenced by a spine bone too much instead of being influenced by the clavicle and upper arm bones.
     
    _GimbalLock_ likes this.
  6. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    _GimbalLock_ likes this.
  7. Phelan-Simpson

    Phelan-Simpson

    Joined:
    Jan 1, 2014
    Posts:
    31
    I checked my model and unity both are using 4 bone influences per vertex.

    @_GimbalLock_
    Just the section where the armpit is.

    I have another model which has better weight painting that I did a while ago as a test and the same result happens. The model below is facing into the light when the arm raises, but I get this weird shiny darkness in the armpit. This happens for every animated or rigged model I import.

    Thanks for the the replies,

     
  8. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Import the model into a new project/scene without the lighting setup. And then setup new lights from scratch, with cast shadows turned on.
    I believe the shading artifact above is due to lighting issue or reflection probe - or something else not related to skinning.
     
  9. Phelan-Simpson

    Phelan-Simpson

    Joined:
    Jan 1, 2014
    Posts:
    31
    Alright I tried it out in a fresh scene, the exact same effect happens. I wondering If for some reason the normal direction of the faces for some reason don't update, because the shadowing in the armpit looks like it could correspond to the shadowing if the arm was down and the polygons weren't stretching

    Maybe the tangents and binomials are not being exported, but I have double checked that the option is checked in the exporter.

    Cheers,
     
  10. _GimbalLock_

    _GimbalLock_

    Joined:
    Feb 26, 2013
    Posts:
    137
    If you're comfortable with posting the character source(s) files. I'd be happy to take a look at them. See if we can reproduce the problem and try and help sort the issue out.

    Are you baking the lighting for this mesh?
     
  11. Phelan-Simpson

    Phelan-Simpson

    Joined:
    Jan 1, 2014
    Posts:
    31
    Here is the blender file. What do you mean by baking the lighting? As it is animated it cannot have baked lighting.

    Cheers and Thanks,
     

    Attached Files:

  12. _GimbalLock_

    _GimbalLock_

    Joined:
    Feb 26, 2013
    Posts:
    137
    You can still bake, but as you pointed out it can have odd affects. Which is why I asked, wanted to be sure... Since the area is in shadow & if you baked from that position. When the mesh deformed you would have something that looked like an render "artifact" that was really just a baked shadow.

    Really, just guessing at possible issues to see what sticks atm. Thanks for the file upload I'll check it out in a few.
     
  13. _GimbalLock_

    _GimbalLock_

    Joined:
    Feb 26, 2013
    Posts:
    137
    Might have an idea on what's going on. The material setting on your mesh needs adjusted. Metallic/Roughness if you are using Unity's PBR shader.... The default material asset that imports in is fairly reflective. In your case it reflects the dark horizon line in your scene. In my case it is much lighter because of the default skybox. By adjusting those setting I was able to remove that shading "artifact".

    I'm guessing once you have you completed asset... Modeling, UV work, texture map creation along the lines of Albedo, metallic, roughness, etc... Then set everything up inside Unity, along with adjusting the material settings, you should be able to hammer out this issue.

    You may want to play with the options in the lighting tab for the GI as well... Once you have your full scene ready... Since these will affect how the lighting (Kinda of a given) will interact with your characters material.
     

    Attached Files:

    • Test.jpg
      Test.jpg
      File size:
      89.9 KB
      Views:
      756
    Last edited: May 2, 2016
    Birdao_Gwra and theANMATOR2b like this.
  14. Phelan-Simpson

    Phelan-Simpson

    Joined:
    Jan 1, 2014
    Posts:
    31
    Alright thanks I will try to reproduce your result by fiddling with the lighting settings.
     
  15. Dahku

    Dahku

    Joined:
    Jan 30, 2013
    Posts:
    15
  16. HallowedTree

    HallowedTree

    Joined:
    Apr 5, 2021
    Posts:
    6
    did this ever get figured out?