Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Shadow casters are rejected earlier if their shadow casting is disabled

Discussion in '2021.2 Beta' started by Peter77, May 12, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,574
    From the Unity 2021.2.0a17 release notes:
    https://unity3d.com/unity/alpha/2021.2.0a17

    What's not clear to me is whether it improves performance when I disable shadow casters that are outside the Shadow Drawing Distance (option found in Player Settings > Quality)?
     
  2. mahdi_jeddi

    mahdi_jeddi

    Joined:
    Jul 18, 2016
    Posts:
    246
    Because of the heavy impact of shadow caster / renderer culling, we wrote our own system that would just disabled the objects based on placement, distance and our own culling groups. I'm interesting to see if this would improve the situation for us.
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,574
    Which reminds me... a few years ago I reported that Occlusion Culling does not cull shadow casters. The Camera is in-front of a wall, but Unity renders all the shadows behind that wall which aren't visible. Basically Occlusion Culling "works 50% only".

    At the time I reported the issue, you choose to not fix it:
    https://issuetracker.unity3d.com/issues/occlusion-culling-does-not-cull-shadow-casters

    However, since you're working on Shadow Caster Culling now, perhaps you can reconsider to fix this issue too. Use the opportunity.
     
    JoNax97 likes this.
  4. mahdi_jeddi

    mahdi_jeddi

    Joined:
    Jul 18, 2016
    Posts:
    246
    To be fair, shadow caster culling is pretty complicated: depending on the position of the light you would have to extrude the bounding box of the object and then check that against the occlusion data. That's way more complicated than just simple box intersection check. It's doable but I guess it's not the focus for them right now.

    We did this manually for our game objects with Culling groups as we knew what the light's angle was, so we could just approximate if the object's shadow is visible in the camera or not. At the end of the day, you have way more information about the composition of your scene and how the objects move, so you can enforce a better culling system. Unity has to paly it safe and avoid any rendering errors whatever the objects' positions are.