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 Very poor visual results from having too many lights?

Discussion in 'High Definition Render Pipeline' started by dgoyette, Apr 24, 2021.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,120
    I was noticing some weird blocky artifacts in my scenes related to some particle lights. Looking into it, it seems that having too many lights on one place doesn't degrade gracefully, as I might expect, but rather creates some unpleasant results. This is under HDRP 7.6 on Unity 2019.4 LTS.

    Here's a simple room where I've started copy/pasting some point lights. No shadows or volumetrics on those lights. So far, it looks fine:

    upload_2021-4-24_12-52-18.png

    When I get to a certain point, I start noticing some artifacts around the boundary of the light. Very blocky, very pixelated:

    upload_2021-4-24_12-53-36.png

    Keep going, and it turns into a mess:

    upload_2021-4-24_12-54-9.png


    My guess is that any given pixel is deciding which lights to be lit by, and the cutoff is very rough. So, all of the "darker" pixels near the edge of the light's sphere are only being lit by those point lights, while the pixels just beyond it are being lit by the much brighter ceiling lights.

    Anyway, this usually isn't an issue. My example here is contrived. But occasionally, based on random chance, a lot of effects can go off at once, creating lots of lights for a short amount of time. This results in some ugly pixelated effects for a second or two until those lights disappear. I was wondering if there was a way to get better results from this, aside from just trying to ensure that there are never too many lights in one spot. None of the settings on the light seem to make any difference with this behavior, and it doesn't seem to be associated with any HDRP settings that I've found.

    You can also see this looking bad by creating a particle system that uses Lights, and letting that system create way too many lights:
     
  2. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    HDRP only allows you to have 24 light sources in one tile(16x16 pixel square). And you can do nothing with it without rewriting HDRP.
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,120
    Thanks. That's interesting about it being based on 16x16 portions of the screen.

    It's too bad there doesn't seem to be any way to set a priority on a light. I assume it's simply based on distance to the light source, and I imagine it could get complicated if priority started getting included. But for these particle lights, ideally all other scene lighting would take priority, and then these little particle lights would only apply their light if there was "leftover" budget for a tile. It's pretty ugly for lots of small lights in a region to prevent stronger light sources from affecting that region.

    Anyway, thanks for confirming the behavior. It's at least good to know I haven't simply set something up incorrectly.
     
  4. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    Actually there is one thing you can try - change rendering mode to forward. In forward mode HDRP use clusters instead of a tiles, you can imagine this like 1x1x1m cubes. It's max 24 light per cluster too, but don't struggle with depth complexity(near lights don't affect far lights)
     
  5. valarus

    valarus

    Joined:
    Apr 7, 2019
    Posts:
    430
    I have the same situation. I was wondering if HDRP can be rewriten to create gaussian overlay for pixelated shadows when tile limit is exceeded to smooth the shadows.
     
  6. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,009
    It's not what you would expect from deferred shading ain't it ;)
    As for advice I can suggest some noisy texture on ground. It masks a little the tiles.
     
  7. DrSeltsam

    DrSeltsam

    Joined:
    Jul 24, 2019
    Posts:
    100
    I also keep running into the 24-lights-per-tile-limit... currently it seems the only "solution" is to use baked lights or keep light ranges as low as possible, but that isn't a silver bullet and obviously doesn't work for all types of games.

    I'm wondering if there are any future plans for HDRP to get rid of the light limit, or at least increase it a bit?
     
  8. DefyGravity

    DefyGravity

    Joined:
    Mar 26, 2020
    Posts:
    6
    You can manage what objects are being lit by which lights using Rendering Layer Mask on the mesh and Light Layer on the lights. You have to enable Light Layers in your HDRenderPipelineAsset file. Then on the light click on the gear for General settings to enable Light Layer.