I'm developing a portal-based scene manager. Basically all it does is to check the portals against the camera frustum, and render their associated portal zones accordingly. Is there any way my editor can generate portal zones automatically with the user having to set the portals themselves only? For example, the Max Payne 1/2 engine ("Max-FX") only required to set the portal quads, unlike the C4 engine where you also have to explicitly set the portal zones.

  • 2
    \$\begingroup\$ How do you divide your level into segments? Your solution will depend on this. For example Quake 1 don't use portals, but it's possible to generate them from the level (BSP) data. \$\endgroup\$
    – kolenda
    Aug 14, 2012 at 11:08

1 Answer 1


It is entirely dependent how you implement and construct your portals in your code, it sounds like you currently rely on the user to physically create a portal from a rectangular shape or poly and transform this into the correct position, which is an editor design consideration.

You can however modify how you verify the placement and use of portals in your code to reflect geometry in your environment and what constitutes as a portal. Say you have a door in an internal environment, within the frame of the door, you can tag the planes of the door frame and check to see if the tagged frames create a loop, then check for a zone on either side of the door. From this, a portal can be automatically generated, but is limited by the shapes of doors.

Define an abstract concept of what a portal is, it is essentially a shape with a location. With this concept, you can create sub-elements that modify the portal concept, but allow more complex definitions, enabling you to portal external environments, but always remember they need defined parameters: a zone either side of the portal and the portal to be a shape and have a transform.

With the data from this concept, now link it to geometry within the environment as I previously mentioned (tagging a door frame to create a loop for example), that automatically generates the portal. The portal will check either side of its faces for the placement of the zone and then add it as a reference within itself, linking it to the frustum culling portion of your code.

If you wish to make it even easier in your editor, you can essentially "paint portals" over doorways, have a widget of a rectangular shape, click over the door frame, it automatically tags the door frame and creates the portal in that shape, that location and references both zones.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .