Constructor/Portals

From TDN

Contents

Portals


Portals in general

Portals are used to make zones. Zones are designed to improve rendering speeds. To be properly constructed, a zone has to be completely sealed by structural brushes and portal brushes. Cracks (spaces between brushes) will cause zone leaks and the zone won't be created during the compile process. If not properly constructed, you may get lower FPS (frames per second) when the game is rendering. Portals can also separate a zone from ambient light or sound. Portals are generally used over windows and doorways.

Constructor 1.0.2 (or higher) supports portals for TGE 1.5.2 and TGEA 1.7.0 with the Export As DIF... export. It supports portals for TGE 1.4.2, TGE 1.5.0, and TGEA 1.0.1 with the Export As Legacy... options.

Another explanation

A simple but flawed way to think of zones is: Every 'thing' in the game 'world' is on this long list of 'things'. It takes time to check the list to see if the 'thing' should be rendered. By putting 'things' into a zone you have created a new 'thing' list for that zone, and now the main 'world' list is shorter.

Portals help define an area so that once none of the portal area is visible, the full area can be ignored. If any part of the portal area is visible, whatever is visible will be rendered but occlude the rest of the zone that is not visible (unless you are inside that zone). It is pointless to use a lot of portals, because now you have created many of the 'thing' lists. It is also pointless to portal an area that is often visible (now the list reshuffling takes as much time as not being in a zone).

The best way to learn where and when to use a portal is to watch your FPS. If you come into an area or view that makes the FPS stutter, portal it off. If that same area is visible from many locations and angles, portals will not help.

How to create a portal

Portals are regular brushes that you convert into portals through Constructor in the same place the other brush types are listed (left hand side, under object properties).

To check to see if the portal is working correctly inside Torque, go into Mission Editor mode and select interior zones from the drop down menu at the top of the screen (or press F9 once or twice). When you move the camera inside the zone you have created, the walls should appear to be green. If the portal is not working correctly, it will display the default white colour that is inherent to all .dif objects that do not have zones associated with them.

To allow sun light to pass through the portal; in Constructor's menu go to: Scene > Manage Entities... Select your portal from the left and change the 0 to a 1 for the 'ambient' setting on the right.

Things to check if you are having problems with portals

  • Make sure your interior is fully sealed and doesn't have any cracks.
  • A portal must be slightly buried inside of the brushes surrounding it. But too much of an overlap can also cause issues.
  • Multiple portals along one plane will lead to problems. In this case one big portal 'may' work best.
  • In past TGE versions, portals can only be touching a maximum of 4 other brushes. Though for TGEA you can have more than 4 brushes touching a portal.
  • Portals must be square or rectangular; you can not make a functional portal if any of the portal's contacting walls do not meet at 90 degrees.
  • It's important that the player can not see across multiple portaled zones. If you have a place like a long hallway, don't put portals along it.
  • Make sure that no detail brushes are penetrating a structural brush.
  • Baked DTS objects (objects imported as static meshes) will not be occluded and will be rendered, even when in a portaled zone. Placing the DTS objects into the building using the mission editor will work and will not render unless you can see inside the portaled zone.
  • By using the debug.exe, you can check your portals by pressing F9 once or twice.
  • Try closing then re-opening Constructor again before exporting or try changing your export settings.

Unproven findings about portals

  • A portal touching a detail brush may cause problems (such as artifacts).
  • Sometimes thicker portals experience problems.
  • Portals made along the X-axis (in Constructor, not the global X-axis in TGE) may not function properly.
  • Portals should not share the same plane as any other brush face.
  • If the opening is small, trapezoid may function properly as portals.
  • Sometimes portals can be made that are touching more than 4 other brushes.
  • Sometimes portals will not work no mater what; and sometimes a portal works even when you try to build it wrong (often if the BSP project is small with only one portal).