Search Unity

Bug SpeedTree8 DepthPass Error in 2021.3.15f1?

Discussion in 'Shaders' started by Phy_rax, Mar 24, 2023.

  1. Phy_rax

    Phy_rax

    Joined:
    Oct 20, 2018
    Posts:
    27
    Hello,

    not sure if what I'm reporting is an issue on my end or a more general issue with the SpeedTree8 shaders.

    First off I'm on URP 12.1.8 and I'm using a custom RenderPass to display distance fog that I calculate in a custom DepthPass for each shader, basically just using the

    Code (CSharp):
    1. output.nz.w = -(vertexInput.positionVS.z * _ProjectionParams.w);
    function and float encoding this via the standard EncodeRG function.

    What is happening now after updating Unity to 2021.3.15f1 is that suddenly this custom depth pass for SpeedTree shaders seems to produce artifacts in a way that the leaves and branches depth value does not overlap with the diffuse values anymore (see screenshot). I didn't have that problem before. It does sway around and all, just at some offset in time maybe? And if I try to use the standard SpeedTree8 DepthPasses by Unity this also happens.

    SpeedtreeDepthError.png

    As you can see where I marked it, the semitransparent area to the left should actually just overlap with the black area and the area without fog should have fog on it or simply overlap with the black area.

    Tried to fix it for some hours now and it seems that the globalWind function call as well as BranchWind function call in the InitializeData() function inside the SpeedTree8Passes.hlsl shader include seems to be causing these issues.

    Thanks in advance, hope anyone can help :)
     
  2. Phy_rax

    Phy_rax

    Joined:
    Oct 20, 2018
    Posts:
    27
    Adding another image with color where it's also clearly visible SpeedtreeDepthError.png
     
  3. Phy_rax

    Phy_rax

    Joined:
    Oct 20, 2018
    Posts:
    27
    For anyone else encountering this error, for me it resolved when disabling GPU Instancing on the materials.