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

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.

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?

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

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.

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

This doesn’t happen under Unity 2021.3.7. It’s a new regression in 2021.3.9.

1 Like

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.)

1 Like

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.

Here’s the issue link: https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-16773

I don’t think it is publicly accessible. After the QA team reproduces the bug they create an issue in the issue tracker like this: https://issuetracker.unity3d.com/issues/editor-crashes-with-system-out-of-memory-error-when-importing-size-heavy-textures

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” :slight_smile:

1 Like

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:

outDecalBuffer.w = (GetMeshRenderingLightLayer() & 0x000000FF) / 255.0;
3 Likes

Great workaround. I’ll test it out later today. (I had rolled my project back to 2021.3.7).

1 Like

is there any ETA when this fix will be available? I noticed that it is also present on 2022.1.17f1.

1 Like

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.

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.

1 Like

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

Can confirm that bug still persists in 2022.1.20.
If both Lighting and Decals layers are enabled no light on Skinned Mesh Renderers.

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 ?
8545577--1142138--upload_2022-10-28_10-54-9.png

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

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.

1 Like

Yes, chasing down unity bugs/fixes and applying them to my abstraction layers with no help from unity is the joy of my life.