Show object only when it is behind something

Hello,

I’m looking for a way to render an object but only when it’s behind a specific object.
I would like my players to be able to see certain object only if they use a “Magic magnifying glass”, and if the object isn’t fully behind the glass I still want the part covered by the magnifying glass to appear and the part that is not covered to stay invisible.

Thank you in advance.

I want to avoid using SceneCapture since it’s in VR and SceneCapture in stereo is really expensive

bumping the post, Any idea ?

The part about the magnifying glass seems doable: You could have two linetraces run from the forward vector of the camera: one that hits the glass and one that ignores the glass so you can trace the object behind it. Get the hit result of both and if both true than set the object visible.

What may be more complicated is the “selective” rendering that you would like. Maybe you could setup a special material with an opacity mask and apply the mask values using vertex paint. But this could be expensive and the mesh should be very high poly.

Yup, I guess the clipping part would be the hardest and the most expensive. If it was on few object that would be ok, but at some point the players will be in front of a mirror with this effect, the two scene are exactly at the same place in world the only way to see world B from World A is through the mirror, since the game use a Mocap system I cannot teleport my players.