Hello, guys! I am making a portal effect and planing to place a cube map at the bottom of the “can”, and side walls would be of panning and rotating material with distortion. The problem is I don’t know how to get rid of outer walls that should not be visible.
On screenshot below marked these with X. In other words I would love to have sort of a “pocket”, that that you can look into only from particular side and should be invisible from other directions. Sort of Harry Potter Invisibility Cloak
I tried render target + some math as shown in youtube tutorial, works but heavy on performance.
Also I tried stencil buffer but it does not work because it operates on rendered mesh, and I can only change color of this part but I dont know what is obscured behind the part I want to discard. May be there are some other ways of doing it, may be it can be done with depth buffer? But depth buffer is applied to whole view. May be some material trick to make it transparent in this part using camera vectors and manipulating normals?