Reputation: 11
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:
Here is the shader code for object A:
Shader "Custom/Mask"
{
Properties{}
SubShader{
Tags {
"RenderType" = "Opaque"
}
Pass {
ZWrite Off
}
}
}
The Universal Render Data settings:
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:
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/ .
Upvotes: 1
Views: 341