Show object only when it is behind something
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.
asked Jun 19 '18 at 06:29 PM in Rendering
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.
answered Jun 28 '18 at 10:06 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here