Search Unity

Question Why is "Static Shadow Caster" separate from other static flags? Should I enable it?

Discussion in 'High Definition Render Pipeline' started by dgoyette, Jan 21, 2023.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    It looks like the setting "Static Shadow Caster" on a renderer should be enabled when using lighting not set to update every frame, but rather with "Always Update Dynamic" enabled:

    https://docs.unity3d.com/Packages/c...h-definition@11.0/manual/Shadows-in-HDRP.html

    I'm confused about why "Static Shadow Caster" isn't among the other static flags (Contributes GI, Batching static, etc). It seems that in almost all cases, if I make an object fully static, I'd want "Static Shadow Caster" enabled as well. But it looks like I'll need to tick that box separately for every renderer, one at a time, versus the static flags' ability to recursively set the property of many child objects at once.

    Is there any drawback to enabling "Static Shadow Caster", assuming the object really doesn't ever move? What's the reasoning for it not being with the other static flags? Is that just a limitation of the engine, that an SRP can't inject other static flags?
     
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    704
  3. francescoc_unity

    francescoc_unity

    Unity Technologies

    Joined:
    Sep 19, 2018
    Posts:
    193
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Thanks. I experimented with Mixed Cached Shadows maybe a month ago, to judge whether I could achieve performance gains by setting most of my lights to update "On Enable" instead of "Every Frame", and enabling "Always Draw Dynamic" on the lights. I didn't really notice any performance change one way or the other at the time. But perhaps I needed to set the various static geometry to "Static Shadow Caster" to have benefited from that? I guess I'll test that out again.
     
  5. francescoc_unity

    francescoc_unity

    Unity Technologies

    Joined:
    Sep 19, 2018
    Posts:
    193

    Yup, no benefits without those flags if you are set to always draw dynamic :) Also keep in mind this only saves on shadowmap drawing, but won't change the sampling cost
     
  6. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Good point. Someone in another thread (https://forum.unity.com/threads/whi...ould-i-use-on-my-lights.1381941/#post-8706540) did mention to me that sample costs aren't affected by this, and that they're the lions share of the shadowing. So, I probably shouldn't expect big gains by enabling this. But it's good to know I'll at least be enabling the feature in the correct way. :)