Portal Lab

What's Happening

It's 2025 and the inquisitive scientists are back and experimenting with WTPortal objects!  The above lab allows you to play around with WTPortal settings and see the result in real-time.   Use the arrow keys and the mouse to fly around the world. 

A WTPortal object is represented internally by a flat rectangular piece of BSP geometry.  The portal camera can be any WTCamera object and is used to render to the face of the BSP geometry.  The Standard Portal allows you to look into another part of your world.  A mirror portal reflects everything the face can see just like a real-life mirror would do.  A regular skybox is a portal that is dependent on the viewing camera’s rotation only and not its translation. So no matter where the camera moves, the image being viewed through the portal face will not get any closer. This gives the viewer the illusion of seeing skies or faraway terrain.  An infinite skybox is the same as the regular skybox, except that its face always renders in the background behind all other objects. This allows you to easily setup skyboxes in outdoor areas.  

Portals can be any size you wish, however they will always be rectangular and can not have setScale called on them.  In other words, once you create your portal, you cannot change its size.

In the scene, the Alien tank has been added as a child object of our WTPortal.  This is to help illustrate the render only children option.  You'll notice that when the portal is not rendering it's children only, the child objects work the same as normal WTGroup child objects and they appear in the main world.  Turning Render only Children on will make the Alien Tank appear as the only object in the portal.  It also removes it from view in the "normal world".   

WTSurfaceShader procedurals and reflection/refraction mapping are not supported on WTPortal objects and generally do not work.  This is why the drop down selections look like the base WT Logo image.   This lab illustrates that procedurals can be made to work if they exist in the scene and have their visibility set to true.  The WTSurfaceShader is attached to a WTGroup added to the stage, and then has WTGroup::setBitmapOpacity (0); called on it to make it 'appear' invisible.  The WTGroup also has its collision mask set to 0.  The same work around will not work with reflection/refraction mapping.

Key Methods Used

WT::createPortal, WTPortal::setCamera, WTPortal::setCustomTransform, WTPortal::setDoubleSided, WTPortal::setMappingOption, WTPortal::setRenderOnlyChildren

Points to Remember