- Home /
How to show a 2D texture through a 3D object like it's a portal?
I have no idea what the proper name for this is called, nor the proper topics to label this as, but how would I show a flat 2D texture through a 3D object (like shown below) as if each side of the 3D object was a portal. I would also like for the edges of the object to remain visible (also shown below) and for the 2D texure to always face the camera of the player character. If anyone could break down how to do this I would be super appreciative.
Thank you in advance.
The terms you might want to search for include "Stencil Buffer" as this is a route to you using the shape of the 3D object to reveal another image through it. This will give the portal effect. Depending on what you want to see through the "portal", you might also want to look into "Camera Stacking" and Render Textures. If you want to keep the edges of the object, then a possible way is that you will have two models. One would give the "cut out" for the portal. The other model would just have the edges (like a wireframe model) with no faces between the edges.
$$anonymous$$aybe this is a starting point:
https://assetstore.unity.com/packages/tools/particles-effects/pocket-portal-vr-85657
Answer by tuinal · Aug 03, 2020 at 11:40 PM
In shadergraph, you just need to hook a screen position node to the UV of the 'portal' texture; then blend it however you want. The right place to ask would be in shadergraph forums since it's a fairly straightforward shader effect - basically it's no different to blending any other 2 textures using add / multiply except one of your textures is in screen space.