Search Unity

Bug SRP ShadowMap depth/bias changes after upgrading to Unity 2021

Discussion in 'Editor & General Support' started by hiwarp, Feb 21, 2023.

  1. hiwarp

    hiwarp

    Joined:
    Oct 26, 2016
    Posts:
    8
    After upgrading to Unity 2021 I have noticed that the shadowMap has different depth / bias from Unity 2020 and prior. I'm using a custom SRP and only Directional light shadows.

    I have read the UpgradeGuide2021LTS, specially the part of the "RT DepthStencil Format", but I can't make it work.

    I have tried different values for: rendertexture formats, graphic formats, depths, bias, ... with no success.

    I suspect something has changed in the way Unity manages the following:
    - Depth are stored differently in the render texture. I'm using compareDepth sampling mode.
    - Bias are calculated differently, so same values are not producing the same result.
    - Projection/View matrices are calculated differently for the light.
    - UNITY_SAMPLE_SHADOW shader macros has changed internally.

    The same scenario looks OK in Unity 2020, but in Unity 2021 the shadows seems to z-fight self geometry.

    Please, anyone can help me to get the same depth bias in the shadowmap rendertexture as works in SRP + Unity 2020?
     
  2. hiwarp

    hiwarp

    Joined:
    Oct 26, 2016
    Posts:
    8
    I have noticed the ShadowMap depth issues occurs on Unity 2020.3.45 and onwards too. (Unity 2020.3.44 and prior seems to works ok).
     
  3. hiwarp

    hiwarp

    Joined:
    Oct 26, 2016
    Posts:
    8
    In the Unity 2020.3.45 release notes: I only can see that introduces "camera-relative culling" options that could affect Shadows/Lights. ?