ColinLeung-NiloCat/UnityURPUnlitScreenSpaceDecalShader

Only project decal on certain objects/layers

ztffn opened this issue · 2 comments

ztffn commented

Is it somehow possible to limit the decal to only render on certain objects?

For example if you use a decal to mark the impact area after an explosion on the terrain, you don't want it to project onto another model, say a player that enters the same area.

yes, you can use the stencil buffer to do it.
1.your ground shader adds "write stencil value K"
2.the decal material set to draw only when stencil value equals K

you can buy professional production-ready URP shaders here,
https://assetstore.unity.com/packages/vfx/shaders/lux-urp-lwrp-essentials-150355

please open a new issue if there is any other problem, I will close it now