Search Issue Tracker

By Design



Found in [Package]


Issue ID




[URP] variables SHAr, SHAg, SHAb are receiving wrong values if there is no shadow pass in the shader

Package: Scriptable Render Pipeline Universal


How to reproduce:
1. Download the attached project named "Case_1256703"
2. Open the NewScene and observe 3 Cyan primitives
3. Open Frame Debugger select the Draw mesh and check the SHAr, SHAg and SHAb values
4. Open AmbientAsColor.shader, and make sure that shader pass line (UsePass "Test/AmbientAsColorWithShadowCaster/SHADOWCASTER") is commented.
5. In the Project View find a material named AmbientAsColorWithShadowCaster.mat and select it
6. Observe the Scene view

Expected result: All 3 primitives are cyan and return the same SHA values in the Frame Debugger as before
Actual result: 2 primitives are grey and return different SHA values in the Frame Debugger

Reproducible with: 2019.4.1f1(7.1.8, 7.4.1), 2020.1.0b13(8.1.0, 9.0.0-preview.14), 2020.2.0a15(10.0.0-preview.0)
Could not test with: 2018.4.24f1(URP not available)

1. Graphics APIs tested: D3D11, D3D12, Vulkan
2. The issue does not occur if line (UsePass "Test/AmbientAsColorWithShadowCaster/SHADOWCASTER") is not commented
3. The issue can be resolved by reimporting the affected materials(Track_1256703_V2). However, selecting the material afterwards will break it again.

  1. Resolution Note:

    The issue is that 'DrawMesh' does not setup any built in constant buffers when drawing, so the draw operations are picking up whatever is left over in those buffers. In this case, when it doesn't work, the rendered Game Object is using the SRP Batcher which does not fill/update that information resulting in zero SHA values. In the working case the shader is no longer SRPBatcher compatible, so takes a different path which fills out that data, and the 'DrawMesh' commands just happen to make use of it.

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.