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
- Any small change in UI Builder Inspector refreshes Editor Inspector
- Inaccurate Box Collider boundaries on a rotated child Cube when the parent GameObject Scale is non-uniform
- [Android] "SHADOWS_SCREEN" set as shader Keyword when no "_ShadowMapTexture" is bound leads to freeze on a build on some Mali GPU devices
- The global scene list is overridden in a project built with command line when the Override Global Scene List setting is disabled in the build profile
- Global Scenes are not included in the Build when building multiple Build Profiles at the same time
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