3

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.

brockmann
  • 12,613
  • 4
  • 50
  • 93
TheLabCat
  • 6,219
  • 2
  • 14
  • 28
  • 2
    Could you illustrate/reference the exact effect you're after? – Robin Betts Jul 01 '21 at 18:07
  • @RobinBetts I edit added a screenshot of the effect in Portal 2. – TheLabCat Jul 01 '21 at 18:17
  • 1
  • @MarkusvonBroady will check this out. Thx. (Third parties: do not consider this as an answer to the question unless later informed otherwise) – TheLabCat Jul 02 '21 at 01:52
  • 1
    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. – Robin Betts Jul 02 '21 at 16:42
  • @RobinBetts Cool lens thing, which I might use for something else. Yes, flexibility is the problem. Thanks for trying. I do faintly remember something in the old blender internal engine where you could use another object viewpoint as a texture, and thus efficiently fake reflection, but of course that’s probably not in cycles. It seems that light probes do this automatically. – TheLabCat Jul 02 '21 at 18:54
  • 2
    @Zargul .. as always.. hope to be proved wrong :) – Robin Betts Jul 02 '21 at 20:02

0 Answers0