#URP deferred shader, shadowcoord required?

1 messages · Page 1 of 1 (latest)

spring frost
#

I am writing a custom shader for the Universal Pipeline, only targetting the deferred path.

Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);`

The function above takes in a shadowcoord value. However i am not sure if this is actually used in deferred. i am copying the logic from built-in shaders to ensure it works in any setting. My goal is also to keep out anything that is not used. I am uncertain if the shadowcoord needs to be set or not.
The logic below is what i see in the shaders from Unity a lot of time.

                #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
                #endif

I have been trying to figure out unsuccessfully when this keyword is true or false. it never seems true or i am testing it incorrectly.
I mostly just want to know if i actually need it or not? without the shadowcoord being set so it being 0, the shadows for the mainlight still seem to cast.

mint owl
#

You shouldn't need the light in deferred path at all, so I don't really get how you ended up here 🤔

#

I think that indeed the shadowCoord is not necessary in that context.

spring frost
# mint owl Hum, ok, if I look at what's happening here, in deferred it is used because the ...

Yeah, it was a bit strange to me, i am mostly copying everything the default shaders have and leaving out anything i will not use. I do think i might need it but only for a very specific lightmap setting. If the baking is set to subtractive lighting it seems to be affected a bit more.
I had tested it by modifying my result

                #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
                color = half3(0,1,0);
                #endif