AreaPortal Visibility By Filami
Objectives • Practice the techniques of visibility determination using Area Portals; • Develop an experimental application showing techniques of visibility determination for interior scenes; • Develop Know How for future game applications in the style of Doom3 or Unreal Tournament.
What are AreaPortals? • A Technique the splits a scene in several areas interconnected by portals; • Lets to compute the visibility of contained objects fast and efficiently; • Effective on interior scenes full of rooms, corridors and the corresponding “doors” or portals.
How to build a scenariowith AreaPortals? • All scenes are built using many objects that adds detail and mood to the scenery; • Those scenes are not adequate for the construction of the data structures, they have got a lot of small details and is difficult to identity the areas.
How to build a scenariowith AreaPortals? (cont.) • The scene is then separated into 2 kinds of objects: • A “Cage” that only has walls, ceilings and floors. • “Static Meshes” with the remaining scene detail; • In the following picture, only the “Cage” is being shown; it is at the same viewpoint as the previous picture.
How to build a scenariowith AreaPortals? (cont.) • It's then inserted new models into the “Cage” that will be identified as portals that will connect the areas.
Construction • After the scene as been loaded from hard drive, this one has to be prepared: • Calculate the scene's areas; • Compute the portals and corresponding area connections; • But first of all, the scene has to be subdivided into convex volumes.
Binary Space Partition (BSP) • The BSP divides the “Cage” into convex volumes; • A BSP is computational binary tree whose divider are three-dimensional planes; • The following image shows a small example of a 2D scene divided by a BSP.
Binary Space Partition (Cont.) • It's possible to note that the BSP actually cuts some triangles; • Those cuts have to be minimized and that is possible using a subdivision heuristic that minimizes cuts without sacrificing the balancing of the tree. • The following images shows the cuts that have been applied by the application.
Binary Space Partition (Cont.) • The following image shows the computational tree generated for the actual test scene; • The blue dots are the nodes containing the cutting planes; • The rectangles are the tree's leaves with the number of “Cage's” faces on that leaf.
Calculating the Areas • After dividing the scene into convex volumes, it is then possible to determine the areas. • The areas are computed using raytracing: • For each leaf pair, a given number of random rays are traced; • If one of those rays is not occluded, the two leaves have to be part of the same area; • The portals do not let rays pass.
Calculating the Areas (Cont.) • Apart form occluding those rays, the portals also uses them to determine which areas it connects. • When a portal receives a ray coming from an area, the portal stores that area and the area is also notified that that portal is in it's inside; • The areas knows it's portals and the portals knows it's areas.
Calculating the Areas (Cont.) • The portals have to be simplified as well; • Their geometries are simplified into rectangles so in the future it simplifies the visibility system workings.
Application • After the needed data structures had been computed it is then possible, through a given point of view, identify which the tree's leaves are potentially visible;
How the Portals are used? • It is calculated a visibility frustum through the point of view to determine which objects are visible; • The portals cuts out the visibility frustum; this way, the frustums are not able to see through the walls.
What about Details? • Now that the scene's areas have been identified and it's possible to determine which leaves are potentially visible, how to insert again the details into the original scene?
What about Details? (Cont.) • Each scene's detail is represented by a polygonal mesh and each mesh has a Bounding Box. That box can be inserted, through the use of the BSP, into a leaf (and corresponding area); • After being inserted into the scene, the polygonal mesh can then use the underlying structure to determine whether it is potentially visible to a particular point of view.
Where are those techniquesbeing used? • A lot of modern games still uses Area Portal or similar techniques to accelerate the drawing of their's interior scenes; • An example is Doom3 that used very similar techniques presented here both for construction of scenes as well for the visibility determination; • The Unreal Engine is also a very effective engine for interior scenes and it also uses some of the techniques presented here.
Prey • Prey is a 3DRealms game that uses the same game engine developed for Doom3; • It uses the same visibility system presented at the original game; • Those images where taken from the playable demo of the game and shows the portals on operation.
Unreal Engine • In an article written for Game Developer Magazine by Lee Parry, Epic Game's lead level designer, it is possible to note that this engine also uses the concept of “Cage” and “Detail Meshes”. “Cage” used for BSP and created using CSG (Constructive Solid Geometry) Addition of “Static Meshes” giving important details to the scene. http://udn.epicgames.com/Three/rsrc/Three/ModularLevelDesign/ModularLevelDesign.pdf
Unreal Engine (cont.) • The following websites from UDN also explains in detail all the techniques used by this engine for scene development: • http://udn.epicgames.com/Two/IntroToUnrealEd.html • http://udn.epicgames.com/Two/LevelOptimization.html
Future Work... • Create a loading and compilation tool for scenes to be integrated into an artistic workflow and level editors; • Develop CSP (Constructive Solid Geometry) to create “Cages” simplifying the artists' work; • Automating placement of portals through the scene.
? ? ? ? ? ? ? ? ? ?