Search the Community
Showing results for tags 'portals'.
-
Howdy my dudes, I've been taking at a stab at building out a "portal" type shader for a few days now, and I'm pretty stuck. To elaborate, the goal is to basically to render from a second camera onto a texture (or render buffer), and then project it onto a piece of geometry to be rendered like any other object. Thus creating the illusion of looking into one portal, and out of a second portal (just like the game Portal). I've already solved rendering from the perspective of the other camera (I think.... I basically rebuilt fromNDC() in /mat/), however I'm currently stuck on how to project it properly back onto the geometry. Let's define the current render camera as "CameraA" and the second, portal camera as "CameraB" for ease of explanation. The issue that I'm running into is that the method I'm using requires me to sample the rendered scene from CameraB, as a texture. The reasoning being, that we need to clip the texture to make sure we're not looking at a squashed scene, but rather a scene that's clipped by the bounds of the portal geometry. However as far as I'm aware, there's nothing like Unity's render targets in Houdini. You could argue that, that's the purpose of the Render COP, however it's far slower than just shooting more rays into the scene from CameraB. Mestela sent me this lovely video by Roman Saldygashev in which he achieved the effect in mantra, so i know it's possible. For even more context, I've been following along with this post by Tom Hulton and his implementation in Unity, http://tomhulton.blogspot.com/2015/08/portal-rendering-with-offscreen-render.html Though in the attached file, I don't include the camera matching transformations he describes, let's just focus on the portal rendering.... I'm going to attach my test file to this post so all the smart people here can rip it to shreds. Please let me know if you think I'm totally approaching this problem incorrectly as well, as shader math is certainly not my strongest skill... If anyone has a link to the "Stupid RenderMan Tricks" pdf that inspired both Roman's effect and Tom's effect, that'd be incredible, because all searches on my end have turned up empty, so i'm kinda just winging it right now. JR_PORTALS_v004.hipnc