everyone; I am using Unity 2022.3.16f with the URP, and I want to create an effect where you can see through object A to object B, as shown in the attached image.
enter image description here
enter image description here
Here is the shader code for object A:
Shader "Custom/Mask"
{
Properties{}
SubShader{
Tags {
"RenderType" = "Opaque"
}
Pass {
ZWrite Off
}
}
}
the Universal Render Data settings:
enter image description here
However, I am encountering an issue where object B is still visible through object A even when object B is in front of object A, which is not the desired effect.
enter image description here
enter image description here
What I want to achieve is that the parts of object A behind other objects should not be written into the Stencil Buffer. I’m looking for any suggestions or alternative solutions to achieve this effect.
For reference, I have been following this tutorial: https://theslidefactory.com/see-through-objects-with-stencil-buffers-using-unity-urp/
QingYu Mu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.