3D Graphic Editor

Free 3D Level Editor with integrated BSP compiler Getic 3D: BSP, Portals, PVS, Light-Maps, Moving Platforms
About Tutorials Getic Resources MOGE

-Getic
    Features
    Download
    PipeLine
    Index

Getic BSP compiler pipeline


Getic compilation process. Consider a scene with:
2 solid brushes (grey);
1 cut brush (red). Fig 1


Fig 1

If the cut brush is placed between the 2 solids as shown in fig 1 it makes a doorway between the rooms. When a brusd chnages its state the CSG operations are recalculated. The CSG happen only between touch-to-touch brushes.

Step 1: brush to BSP:
Each brush is BSP-ed(Fig 2).

Fig 2

Step 2: CSG Hidden surface removal
All touching brushes of same type (cuts with cuts and solids with solids) are union-ed by CSG operations betwenn BSP's. The 2 solids are being added in one big solid. (fig 3). The cut brush remains as it is.

Fig 3

The resulting solid has no inner surfaces as resulting from CSG unioning Fig3/2. The solids are then CSG-ed with the touching cut brushes. Fig 4. The result is a new solid brush.




Fig 4.

Step 3: Exterior Surface removal.
From all remaining solids Getic builds again a new BSP. (The BSP graph in right side does not reflect the real BSP for the given scene)

From the BSP's nodes planes Getic it builds the initial portals (see the bsp compiler sample source code). Trough a portal build process (see source code of the BSP compiler) Getic eliminates false portals.

Remaing portals delimit only convex regions with inner surfaces.

From the center of the BSP, considered empty Getic starts flooding the BSP interior by walking recursively in each leaf trough the portals. The scene should be also completley watter-sealed.

All interior polygons were flagged 'wet'

Getic removes all ‘dry’ polygons. Remaining scene is shown below. Outside space is considered solid (non walkable). The scene now has only polygons facing inward.

Step 4 Portals: Again a new BSP is build with the remaining polygons. The BSP graph is paint there just to show the next step in the process and does not reflect the real BSP tree for the scene. The BSP information as nodes and leafs is saved in the BSP file.

The portal compiler is spawn again against the new BSP to build the final portals. The portal information is then saved in the BSP file.

Step 4 PVS Leaf information is saved in the BSP file. PVS is calculated between leafs (see the bsp compiler).

Step 5 Light Maps. All interconnected polygons with appropriate properties are collected untill they best fit in the ligth map maximum size. A lightmap is shared among these polygons.

The accumulation of polygons stops when both dimensions are about to exceed the maximum surface light-map dimension on U and V. The maximum lightmap image us computed by the maximum light-map x/y pixels multiplied by the lumel size (x,y). Then the MLCL area is rounded up to the closest power of 2 (yellow).

Next image shows the grid of lumels. Lightmap intensity is computed for each lumel center. In our case the lightmap image has 8x8 pixels.

From each lumel center we fire a segment to the light point. If the segment collides with the BSP the lumel is unlit. The light intensity is calculated taking the segment length and the angle of impact. The intensity information is sored in each bitmap lighttmap pixel. A texture ID is generated with the bitmap

Polygons vertexes are mapped into the UV texture space.

The lightmap texture is rendered for each associated polygon

IN tthis example, all the poygons in the scene share the same lightmap ID.

web Mail

Graphics: Reea

Sponsor: EnjoyDecor

By: Marius C.O.