Search Issue Tracker

By Design

Votes

1

Found in

2021.3.37f1

2022.3.23f1

2023.2.17f1

6000.0.0b14

Issue ID

UUM-68470

Regression

No

Shader pass overridden by fallback when using "UsePass" directive

--

-

Reproduction steps:
1. Open the attached “repro_IN-72668“ project
2. Open the “/Assets/Scenes/SampleScene.unity“
3. Open either the Scene view or Game view
4. Observe the “Sphere“ GameObject

Expected result: The “Sphere“ GameObject appears red
Actual result: The “Sphere“ GameObject doesn’t appear red

Reproducible with: 2021.3.37f1, 2022.3.23f1, 2023.2.17f1, 6000.0.0b14

Reproducible on: Windows 10 (22H2)
Not reproducible on: No other environments tested

Notes:

* Reproducible in Player
* The custom surface shader defines a pass that should render the “Sphere“ GameObject red, or, in other words, return a (1,0,0) value. However, the Editor is also drawing the fallback shader's "Diffuse" pass after the custom shader's pass. This fallback shader pass most likely defines a different color, overriding the red color definition
* Frame Debugger shows that the “Diffuse“ shader’s pass is drawn after the correct surface shader’s pass. This confirms that both the fallback shader and the custom shader is invoked

  1. Resolution Note:

    UsePass adds all passes that match the given name in the given shader, including its fallbacks.

Comments (2)

  1. koko_dl

    Apr 12, 2024 07:21

    This bug should OBVIOUSLY NOT be marked as 'by design.' And the previous versions of Unity do not have this bug.
    I wonder if the resolution note was processed by anyone who has written even a single line of shader code?
    A fallback shader should absolutely not be displayed alongside the original shader.
    It is called as "fallback", isn't it?

  2. koko_dl

    Apr 03, 2024 09:16

    Additional information:
    * This bug will not reproducible if we don't use UsePass instead of write a big shader contains all required code
    * It is considered as a regression of the fix to UUM-36470:
    https://issuetracker.unity3d.com/issues/usepass-doesnt-reference-passes-within-another-shaders-second-subshader

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.