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
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)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Warnings in the Bug Reporter window are cut off and not truncated when the Bug Reporter window is resized to its minimum size
- Color is incorrectly applied to objects when initialized with non-normalized parameters
- SerializationUtility.GetManagedReferencesWithMissingTypes() don't return null when “Prefab has missing SerializeReference Types“ warning banner is present
- Memory leak when VFX Graph is open and Camera has "Target Texture" enabled
- The Canvas component's warning box is missing an apostrophe when Additional Shader Channels is set to "Normal" and "Tangent" with Render Mode set to "Screen Space - Overlay"
Resolution Note (fix version 13.1.1):
Fixed in 2022.1.0a16
The shadow caster now requires the newest changes to Normals.
Resolution Note (fix version 12.1.1):
Fixed in 2021.2.2f1
Resolution Note:
Fixed in Shader Graph 10.8.1