Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug IN-16773: Regression: Skinned Mesh Renderers lose lighting when enabling Light and Decal Layers

Discussion in 'High Definition Render Pipeline' started by dgoyette, Sep 15, 2022.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    3,959
    I've just upgraded from 2021.3.7 to 2021.3.9. I immediately noticed that all Skinned Mesh Renderers in my project now render nearly completely black. There seems to be a tiny amount of color on them, but the lighting is all wrong.

    upload_2022-9-15_18-27-11.png

    This is only in the Game view. In the Scene view, everything looks correct. This occurs even if I create a completely new scene and drop a new camera into it. However, it's not occurring in every project.

    I notice there's a flicker occasionally where one of the SMRs appears to render properly for a frame, then it immediately goes dark again.

    If I switch back to 2021.3.7, everything renders fine again.

    Any ideas of what can cause this?
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    1,984
    I suggest making a bug report for now.
    Let's hope someone has a fix in the meantime. You can maybe import the characters in a blank hdrp project and see where it starts breaking
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    3,959
    I ended up figuring out the specific combination of settings that results in this bug, and reported it as IN-16773.

    In a brand new HDRP project, if you enabled both Decal Layers and Light Layers, skinned mesh renderers will lose their lighting, and appear to only be lit by the current Visual Environment.

    In this screenshot, Light Layers are enabled, but Decal Layers are disabled.

    upload_2022-9-16_1-14-47.png

    Now I simply enable Decal Layers in the HDRP Asset, and now the Skinned Mesh Renderer goes dark:

    upload_2022-9-16_1-15-27.png

    This doesn't happen under Unity 2021.3.7. It's a new regression in 2021.3.9.
     
    DevDunk likes this.
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    3,959
    Worth mentioning that today's 2021.3.10 update didn't do anything to change this behavior. (Not that I'd have expected it to, since the bug was only just reported.)
     
    DevDunk likes this.
  5. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    246
    Could you please post the link to the issuetracker? I would like to vote on it at least since it is another thing that is locking me in the earlier versions of 2021.3 LTS.
     
  6. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    3,959
  7. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    246
  8. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    496
    Hey; Thanks a lot for the report.
    On our side, we managed to repro it easily.
    I'll keep you posted on this thread with the public issue tracker once it's "live" :)
     
    dgoyette likes this.
  9. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    496
    A fix is on the way. Hopefully it will land as soon as possible in the 2021.3 line.

    In the meantime, if this is critical to some of you, the fix is a one liner and can easily be applied on a local HDRP Package:
    upload_2022-9-21_15-44-20.png

    Code (CSharp):
    1. outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0;
     
    yuriy000, eggsamurai and dgoyette like this.
  10. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    3,959
    Great workaround. I'll test it out later today. (I had rolled my project back to 2021.3.7).
     
    chap-unity likes this.
  11. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    246
    is there any ETA when this fix will be available? I noticed that it is also present on 2022.1.17f1.
     
    Michal_Stangel likes this.
  12. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    496
    The fix will be backported to 2022.2 / 2022.1 and 2021.3
    No ETA for now, I'll post there with version number once it lands but you can follow it here.
     
  13. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    246
    Thanks for the info. I've voted for that, maybe it will count somehow. It is kind of weird for me, for such bugs to surface since it is clearly visible in any project with skinned meshes and light/decal layers combo.
     
    chap-unity likes this.
  14. yuriy000

    yuriy000

    Joined:
    Oct 14, 2021
    Posts:
    3
    Alternatively we can set the color write mask in HDRenderPipeline.RenderObjectsMotionVectors to RGB_ which will also work for any other shaders which have a custom MotionVectors pass
     
  15. Michal_Stangel

    Michal_Stangel

    Joined:
    Apr 17, 2017
    Posts:
    116
    Can confirm that bug still persists in 2022.1.20.
    If both Lighting and Decals layers are enabled no light on Skinned Mesh Renderers.
     
  16. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    496
    I just tested on a fresh project and it seems to work fine on my side.

    Are you sure you are on the right version, the bugfix landed in 2022.1.20f1_01d83b40d570 ?
    If you look for this file you have that fix ?
    upload_2022-10-28_10-54-9.png

    If yes to both questions, can you send a repro project ? Thanks.
     
  17. Michal_Stangel

    Michal_Stangel

    Joined:
    Apr 17, 2017
    Posts:
    116
    I've just realized that HDRP Lit shader works fine after the update, but I use Better Lit Shaders from Asset Store. So author will probably need to do some adjustement.
    Thanks for info.
     
    chap-unity likes this.
unityunity