Search Issue Tracker

Fixed in 13.1.1

Fixed in 12.1.1

Votes

0

Found in [Package]

12.0.0

Issue ID

1349095

Regression

No

[ShaderGraph] Shadow bias is broken in generated HLSL when modifying the normal in Vertex shader

Package: Scriptable Render Pipeline Universal

-

If you modify a normal in the vertex shader but don't use it in the fragment shader, shadows are broken if you have any normal bias (which is the default). This is due to the shader generator not writing the modified normal world space position back to the vertex structure, which causes it to use the original, unmodified normal for shadow calculations. This breaks almost all non-trivial vertex animation.

How to reproduce:
1. Open the attached project's Scene labeled "SampleScene"
2. Enter the Play Mode
3. In Game View, inspect the "Cube" GameObject's shadow as it spins

Expected result: The shadow looks the same as when rotating the GameObject without using Shaders
Actual result: There are seams in the GameObject's shadow as it rotates

Reproducible with: 10.6.0 (2020.3.16f1), 11.0.0 (2021.1.17f1), 12.0.0 (2021.2.0b5, 2022.1.0a4)
Couldn't test with: 7.7.1 (2019.4.29f1) (Vertex shader in ShaderGraph not available)

  1. Resolution Note (fix version 13.1.1):

    Fixed in 2022.1.0a16
    The shadow caster now requires the newest changes to Normals.

  2. Resolution Note (fix version 12.1.1):

    Fixed in 2021.2.2f1

  3. Resolution Note:

    Fixed in Shader Graph 10.8.1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.