#Object not rendered behind stencil mask

1 messages · Page 1 of 1 (latest)

timber mulch
#

I need help debugging why the object behind my stencil shader doesn't render in game mode but does render in editor. I assign the object to the a specific stencil layer, and the place a quad over it with another layer. The quad has this shader applied:

Shader "Custom/StencilMask" { Properties { [IntRange] _StencilID ("Stencil Id", Range(0, 255)) = 0 } SubShader { Tags { "RenderType"="Opaque" "Queue"="Geometry" } Pass { Blend Zero One ZWrite Off Stencil { Ref [_StencilID] Comp Always Pass Replace Fail Keep } } } }

I added render objects to my urp settings

wraith bramble
timber mulch
#

@wraith bramble I opened the frame debugger as you suggested and I don't see the second render object that is supposed to render the objects behind the stencil mask. Changing override mode doesn't have any effect.

wraith bramble
#

Can you clarify the setup a bit? You have that grey floor that has the default layer? Then the fan object underneath it(that has what layer and material?)? Then the black quad on top of the grey floor that has a stencil layer?

timber mulch
#

The concrete floor is in the "Default" layer, the fan is in the "Stencil" layer and the quad is in the "TransparentFX" layer. In the urp renderer asset I filter out "Default" and "Stencil" layers and then render them in the render features. This image is from the scene view

wraith bramble
#

Can you take a screenshot of the frame debugger around after opaque rendering?

timber mulch
#

I changed the names of the render objects to "Stencil Mask 1" and "Stencil Mask 2". "Stencil Mask 2" is supposed to render the stencil layer that the fan is in.

wraith bramble
timber mulch
#

right

wraith bramble
timber mulch
wraith bramble
#

So in the stencil mask 1 render pass you see the black quad being drawn?

timber mulch
#

The quad isn't black it's just the camera background color.

#

I believe it's drawn in "DrawOpaqueObjects" pass

wraith bramble
#

What is drawn in that one stencil render pass then?

timber mulch
#

Those are all the objects in the "Default" layer

wraith bramble
#

Do you have any custom layermask set in the camera?

#

Maybe just take a screenshot of it

#

Basically, if the render pass does not appear, it means that no draw calls were submitted for it. Which in turn means that all possible candidate objects were filtered out early on on the cpu side.

#

For example if the camera is set to skip the specific layer, or due to culling.