- Home /
Shader shows different result in viewport than gameview
I edited a Universal Render Pipeline/2D/Sprite-Lit-Default shader from github. The unedited shader works exactly like the official Sprite-Lit-Default from Unity. The subshader uses the Tags "Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline"
, and the first pass is using the Tags "LightMode" = "Universal2D"
. The second pass is using the Tags "LightMode" = "NormalsRendering"
. The third pass is using the tags "LightMode" = "UniversalForward" "Queue" = "Transparent" "RenderType" = "Transparent"
For testing I returned red in the first pass, green in the 2nd pass and blue in the third pass. Now if I look at the viewport, I see red, in the game view I see blue. How does Unity choose the pass to use and how can I make sure it uses the 2nd pass? I want to use normal mapping which only seems available in the 2nd pass.
P.S. I made a shader code that creates a normal map based on a height map which is why I want to use the Pass that supports normals.
Update: All passes are executed, but what makes one work for the viewport and another work for the game view?