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. Dismiss Notice

Question Unity 2021.2.0b5 URP Deferred Rendered Lights Flickering

Discussion in 'Universal Render Pipeline' started by WavingBear, Aug 6, 2021.

  1. WavingBear

    WavingBear

    Joined:
    Sep 15, 2018
    Posts:
    4
    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 - https://drive.google.com/file/d/15xlxcVo90W1bsxrpfGit2dMq_K9IMV83/view?usp=sharing
     
    lc0040 likes this.
  2. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    481
    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.
     
    lc0040 and WavingBear like this.
  3. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    120
    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.
     
    lc0040 and WavingBear like this.
  4. lc0040

    lc0040

    Joined:
    Aug 7, 2015
    Posts:
    2
    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?
     
  5. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    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).
     
  6. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    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 :(

    (I'm in 2021.3.2f1)
     
    Last edited: Dec 13, 2022
    Kingblade likes this.
  7. Kingblade

    Kingblade

    Joined:
    Jan 15, 2014
    Posts:
    14
    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?