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

Bug HDRP shadows flickering

Discussion in 'High Definition Render Pipeline' started by KnightsFan, Jun 17, 2023.

  1. KnightsFan

    KnightsFan

    Joined:
    Jan 2, 2014
    Posts:
    29
    I posted this same bug a year ago when updating to Unity 2021.3 and got no replies. I updated to 2022.3 (HDRP 14.0.8) and it's still present. I don't experience it with 2020.3.

    When a scene has a lot of lights (> about 30 point lights), shadows flicker. A lot. This is in both scene view and game/play mode. This video shows the problem.

    Does anyone else have this? Just me? I'm sure I have a setting messed up somewhere. Would be great to have any kind of pointer. Happy to post any info that would be relevant.


    Also... this is my third frustration post today about 2022.3. I've used Unity since 3.x and only posted 10 times. I completely understand bug, quirks, and annoyances-- but every release, Unity is more broken. I try new Unity versions on personal projects before using them on professional projects. As of now I'm recommending my company stay on 2020.3 because of bugs in the last two LTS versions.
     
  2. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    242
    I don't have my HDRP project open right now - but basically you need to check the settings in your HDRP asset to allow enough simultaneous lights. Also side note, if you have 30+ point lights, I'm assuming they are not real-time shadow-casting.
     
  3. KnightsFan

    KnightsFan

    Joined:
    Jan 2, 2014
    Posts:
    29
    Thanks for replying! I had set my max light count well above what I needed. They are real time shadow casting lights. In build, I have a culling system. Flickering is annoying in scene view while editing, but the frustration is from behavior changing version to version and not being able to figure out why. Of all my 2022.3 problems, this was the one I was most sure was simply not finding the right setting.

    After some trial and error, I've found that increasing the Light Atlas Resolution removes flickering. So for anyone who comes across this in the future, you can add up your shadow-casting light resolutions, and make sure they will fit in the Light Atlas size you pick (see image below for setting location). This is the documentation. https://docs.unity3d.com/Packages/c...h-definition@14.0/manual/Shadows-in-HDRP.html

    upload_2023-6-20_13-25-31.png

    I'm still trying to find all the parameters. If I add the more lights than fit in my atlas size, it flickers at close range, but there's a distance threshold beyond which the flickering stops. But I don't know what that distance is or where to change it. Maybe the light's shadow resolution halves at some range? If anyone knows, that would be very useful information.
     
  4. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    242
    If you have your own culling system going, maybe you can set the lights to non shadow-casting in the editor, and enable shadow casting for the nearest X lights to the camera as part of your culling system.
     
  5. KnightsFan

    KnightsFan

    Joined:
    Jan 2, 2014
    Posts:
    29
    Not a bad idea. I do need to be able to see the shadows while designing the lighting though. So I'll probably drop the shadow distance for editing.
     
  6. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    543
    This sounds like you're reaching the light limit per tile in HDRP.

    Use the Render Pipeline debugger

    Window > Analysis > Rendering Debugger > Lighting tab > Tile/Cluster Debug > Tile

    If you have reached the limit then it may be a case of combing the light fall or multiple lights in a different way, instead of 1:1 representatives, like an area light for multiple low priority lights.
    You can only have 24 lights per 8x8 tile, it Will just cull otherwise or behave weirdly.