Search Unity

HDRP volumetric lighting appears to be not updating its cache, casting dark shadows

Discussion in 'High Definition Render Pipeline' started by brainwipe, Apr 2, 2020.

  1. brainwipe

    brainwipe

    Joined:
    Aug 21, 2017
    Posts:
    78
    Edit - This was my misunderstanding of shadow maps - I've left it all here to help others

    I'm unsure if this is a bug or my misunderstanding. I've recently added a new feature to my game which involves a big hole, when I sink an object into the new hole, the lighting appears to stop. When I select any of the nearby dynamic point lights and toggle the volumetric checkbox on the light then the problem corrects itself.



    Is there something I'm fundamentally missing here or is this a known issue? Happy to create a bug if not wasting time.

    More notes
    • All my lighting is dynamic - although I did experiment with shadow maps (to see if there was performance gain and there wasn't).
    • The effect is identical in scene view, game view
    • I can't tell if it was present in previous builds because I updated all my packages and the editor before I started the feature
    Are there any settings you'd like to see?

    Versions:
    • Editor: 2019.3.6f1
    • HDRP: 7.1.8
    • Post Processing: 2.3.0
    Thanks in advance!
     
    Last edited: Apr 2, 2020
  2. brainwipe

    brainwipe

    Joined:
    Aug 21, 2017
    Posts:
    78
    Problem: my ignorance of shadow maps.

    At the top of the hole is a lift. When the game starts, the lift is at the top of the hole, its mesh is assigned to cast shadows. When the lights are enabled (once at the start), each creates a shadow map assuming that the lift isn't going to move. So the lift casts a shadow and that's the shadow you can see on the cube.

    When the lift is moved down then the shadow map doesn't change because I have the shadow map calculation in the light properties set to "enable". When I was flicking the volumetric checkbox, that was causing the shadowmap to recaculate (probably re-enabling).

    So the fixes are: set shadows to recalculate every frame (expensive but better fidelity) or set the lift to not case a shadow (in this case the better option as the player never goes under the lift).

    I'm leaving this all here so that others might find it useful!