Unity 2021.2.0b5 URP Deferred Rendered Lights Flickering

Hi Everyone,

I am using Deferred Rendering for URP Unity 2021.20b5 and I keep getting this weird behaviour with the lights in my scene. They flicker on\off depending on where the player is in the scene.

If I drag new lights into the scene once in play mode , those new lights don’t have this flicker behaviour - which makes me think its not a issue with the light limit.
It seems to only happen to the lights that are spawned in with the Map prefab.

Another note - we did have the lighting working in unity 2019 using Built in render pipeline and recently update.

Any help or advice would be incredibly helpful - we have tried solutions by tweaking URP asset, project setting , camera settings and many others but have hit a dead end!

Here’s a link to a video of the behaviour - Unity 2021.2.0b5 URP - Lights flicker.mp4 - Google Drive

1 Like

Decals do the same with deferred in b5, but I didn’t check in b6. Since it is still in development, it is most like a bug.

2 Likes

Have the same issues (0b4). It worked fine, but flickering appeared after I’ve added a cookie to one of the lights. I’ve filed a bug report, but it has not been processed yet.

2 Likes

2021.3.3 f1 Same issues. If [Disable] the Additional Lights in URP Asset > Lighting, flickering is gone. I think it’s definitely a bug. However, it is not a solution because we have a custom shader that uses additional lighting. Has it been resolved in other Unity versions? Or is there a solution?

Check that none of your lights have a cookie texture in the ‘missing’ state (rather than ‘none’ or an actual texture). I’ve seen this cause light popping that looked like a culling issue, and spent quite some time debugging the internals of shaders to track it down.

Also switch your inspector into debug mode, and check ‘use bounding sphere override’ isn’t turned on for the problem lights (could potentially set lights to cull incorrectly).

There’s definitely an issue that relates to light cookie data that can cause lights to disappear - but it looks like there’s more to it than missing textures.

When a light fails to render, it appears that those lights have a _CookieLightIndex of >=0 and _LIGHT_COOKIES enabled when the light shouldn’t have a cookie.

I think this happens when there are no lights rendering cookies, but for some reason LightCookieManager is failing to clear the contents of m_VisibleLightIndexToShaderDataIndex[ ]. But I’m not sure what gets it into this state and don’t have a particularly reproducable case :frowning:

(I’m in 2021.3.2f1)

2 Likes

WOW, I’ve just spent 2 days trying to figure this out, and only now have SOMEHOW found this post and solved it thanks to @bluescrn 's insight.

Two things solved can solve this issue:

  1. Disabling all the lights that contain a cookie
  2. Give a completely white cookie to ALL the lights in your scene that didn’t have a cookie before.

Both of these solutions remove the possibility of the bug bluescrn described from happening.

Hey @ManueleB , any chance to fix this issue?

After struggling for weeks we finally fixed this with the Blank Cookie way!!! (It also works in Build.) We tried set Render Mode to Important before, but that didn’t work for us. Thank you soooo much!