Search Unity

Shadow calculation frequency with rotating directional light

Discussion in 'High Definition Render Pipeline' started by AlTheSlacker, Mar 25, 2021.

  1. AlTheSlacker

    AlTheSlacker

    Joined:
    Jun 12, 2017
    Posts:
    326
    Unity 2020.3.1f1, HDRP 10.3.2

    Using a Physically Based Sky:
    Update Mode: Realtime
    Shadows: Max Distance 150

    I have a directional light representing the sun (Celestial Body):
    Directional, Realtime

    Casting Shadows:
    Update Every Frame, Resolution high.

    I smoothly rotate the sun across the sky (incrementing rot.x in Update). Looking at the sun in game it appears to move smoothly. Looking at the Rotation X value it appears to increase uniformly per frame. The shadow on the ground jitters back and forth about the average light orientation: This is not desired.

    I added some code to delay the rotation update by X frames (Update calls), I need to get to almost 1 second's worth of delay to get discrete steps in one direction. But of course this is too infrequent to be smooth.

    I can set the Directional Light angle to any hard coded value and as long as I do not move it the shadow cast is perfect. It appears that when I move the directional light the shadows are either getting cached or there is some attempted prediction being used.

    The rest of the HDRP setup is as near to default as I can remember. The environment is an empty terrain with one cube in the middle of it (the shadow caster).

    Any thoughts?
     
  2. AlTheSlacker

    AlTheSlacker

    Joined:
    Jun 12, 2017
    Posts:
    326
    Simple reproducer using just a basic HDRP install and a directional light.
     

    Attached Files:

  3. AlTheSlacker

    AlTheSlacker

    Joined:
    Jun 12, 2017
    Posts:
    326