I am wanting to create Aperture Science style portals, And I’m aware of various compositing techniques to do this, but to make it more flexible I am thinking about using Open Shading Language. I do not know much about OSL, but the principle in mind is to basically have the shader take a ray trace that’s coming at it, and send it out of a different object, translating the first object’s local space into the other’s (possibly with a tiny bit of offset so it doesn’t then collide with the second object, but that may not be necessary if we can take normals into account)

In short, is this or a synonymous implementation possible, and how would it be done? I’ll be looking up resources on OSL in the meantime if I can.

This is what it looks like in Portal 2:

what portals look like

As you can see, one portal is connected directly to the other. For clarity, the small swirly blue-and-orange icon in the center of the screen (showing over the bottom of the orange portal) is a crosshair and is unrelated to the effect at hand. A holographic outline of the orange portal also shows through the testing sphere, and that is also unrelated.

  • 2
    $\begingroup$ Could you illustrate/reference the exact effect you're after? $\endgroup$ Jul 1 at 18:07
  • $\begingroup$ @RobinBetts I edit added a screenshot of the effect in Portal 2. $\endgroup$
    – TheLabCat
    Jul 1 at 18:17
  • 1
    $\begingroup$ You might find this useful: Youtube: How were the portals in Portal created? | Bitwise $\endgroup$ Jul 1 at 18:56
  • 1
    $\begingroup$ I personally don't think OSL has anything to offer here, even if you go the (nutty) route of taking over all the shaders and casting all the secondary rays yourself. If you just diverted rays, you are in the territory of Rich Sedman's refraction methods? AFAIK the only reasonable route to getting one camera's view into another's at frame n is compositing, as here. The interesting problem is then how automatically to coordinate the camera(s) views in separate scenes, with minimum hassle. $\endgroup$ Jul 2 at 16:42
  • 2
    $\begingroup$ @Zargul .. as always.. hope to be proved wrong :) $\endgroup$ Jul 2 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.