Unity Issue Tracker - Special Values from SurfaceOutput Struct are stripped when using them in the #if UNITY_PASS_FORWARDBASE directive
Closed
UUM-72657
Special Values from SurfaceOutput Struct are stripped when using them in the #if UNITY_PASS_FORWARDBASE directive
Unity: Shader System
As Designed
6.0.X
2022.3.X
2021.3.X
Pass type defines are not present in the phase that analyses the surface shader code.
You can use SHADER_TARGET_SURFACE_ANALYSIS:
#if SHADER_TARGET_SURFACE_ANALYSIS || UNITY_PASS_FORWARDADD
...
#endif
How to reproduce:
1. Open the user-attached project “SurfaceShaderBug”
2. Open the “SampleScene” scene
3. Observe the “Cube” GameObejct in the Scene View
Expected results: The “Cube” is black
Actual results: The “Cube” is red