I followed a tutorial for unity URP stencil to hide objects, I want to use it to hide terrain grass under objects like vehicles, houses, etc..

The tutorial says to create 2 layers, and create render objects for both layers (setting "BeforeRenderingOpaque" for both.

Although masking (hiding) grass under objects worked, now my grass acted as transparent for post-processing FX / other render objects like Ambient Occlusion and Space Screen Shadows.

For example the black rim around tree trunks created by ambient occlusion was visible through the grass.

I was unable to find a solution so I randomly clicked around, and the problem seems to be solved if I change grass layer from "BeforeRenderingOpaques" to "AfterRenderingTransparents".

Now this seems a bit "hacky" and I am wondering what consequences this might have for my terrain grass in terms of lighting, shadows, visibility, occlusion, etc.. basically what might go wrong due to this?

So far in my minimal demo scene nothing seems off to me, but I want to know whether I can consider it solved or not.

I'm unfamiliar with shaders and have zero clue what "After transparents" or "before opaques" really means / the implications for my grass.

Unity 2022.3.25f1 LTS, URP 14, Forward rendering, Linear color space. Ambient occlusion used is an asset called HBAO (Horizon Based Ambient Occlusion).

I tried solving the problem in other ways and nothing seems to be working apart from this.



You must log in to answer this question.

Browse other questions tagged .