BSP Visibility and Rendering
Doom’s renderer is not a general polygon pipeline. It exploits the constraints of a 2.5D world through a BSP traversal, solid wall clipping, visplanes for floors and ceilings, and a deferred masked pass for sprites and transparent textures. The principal files are r_main.c, r_bsp.c, r_segs.c, r_plane.c, r_things.c, and r_draw.c.
Front-to-back traversal
A BSP divides the map into recursively partitioned regions. R_RenderBSPNode traverses the nearer side first, allowing the renderer to use the screen-space coverage already produced by solid walls to reject hidden geometry on the far side. This is not simply a spatial index; it is also an ordering mechanism for the renderer’s occlusion model.
Wall segments are projected and clipped into column ranges, planes are collected as visplanes rather than emitted as arbitrary polygons, and masked objects are held until the opaque scene establishes the relevant depth relationships. The renderer’s data structures make sense only together: treating BSP traversal, wall columns, and visplanes as independent effects misses the way they cooperate to keep the original software renderer fast.
The source is a good reminder that a renderer should be studied in the representation it actually uses. Doom does not “draw triangles badly”; it renders a constrained world through a specialized visibility and column-composition pipeline.