I’m trying to mask out the part of an object that appears behind a glass pane. I’ve been trying to do something with custom stencils but haven’t figured out how to do it. Any help would be greatly appreciated. This is in Unreal 5.3
This can only really be done if the object behind the transparent object is also transparent, since opaque objects can’t sample the stencil buffer.
There are numerous drawbacks to using transparent materials on seemingly opaque meshes, so in general it should be avoided.
Depending on the scope of the effect you’re trying to apply, it can also be done in the opaque shader using other tricks, like manually telling the opaque material where this plane is manually, so you can mask out the correct area. The “virtual plane coordinates” node can be used to project a fake plane coordinate system that could be sampled inside the opaque material and used as a mask.