Saturday, May 28, 2011

More BSP compiler hacking...

I've started working on my engine's BSP compiler (based on Q3Map2/XMAP2) looking to add proper shader parsing and areaportal detection. Currently the shaders are all parsed by libdecl which avoids duplication of code between the engine and utilities.

The engine does not yet use portal based rendering (which is why you can see light clipping through the wall in the images.) The BSP compiler has portal debugging enabled, which outputs an extra surface with a translucent shader for areaportal visualization and debugging.

This is a very simple demo map, however you can already see several issues. The BSP compiler needs to carve the polygons into discrete areas (e.g. the floor polygon should not span two areas.) There are still a few areaportal bugs in the BSP compiler, and of course the engine must be updated to use areaportal based rendering.

 Image showing light leaking through the wall/areaportal.
Image showing the triangles rendered; the floor and walls should be carved at the areaportal boundary.

Who knows, maybe I'll even get this finished before id Tech 4 is (hopefully) released under the GNU General Public License.