BSP Last edited 2 months ago2024-09-03 14:49:11 UTC

BSP, short for Binary Space Partitioning, is a computer graphics technique of organizing 3D space into a tree data structure to speed up rendering. First widely used in id Software's Quake, with each game level organized into .bsp files, where "BSP" entered general parlance.

User posted image GoldSrc being a derivative of Quake's idTech 2 engine, and User posted image Source in turn being a derivative of GoldSrc, also uses the BSP file format for their levels. However the binary structure of BSP file between these game engines are incompatible with one another (and in case of Source, between different versions of Source)

GoldSrc BSP

BSP file in GoldSrc has an internal version number of 30, and when talking about all the BSP versions, referred to as BSP30.

The BSP file is structured into lumps, where each lump holds one kind of data (e.g. an array of the same struct), for a total of 15 lumps:
Lump Description Referenced by
Entities All the entity data from the source .map format. This is in text format. Ripent can export/import this lump.
Models Each brush entity in the map file becomes a BSP model. The worldspawn is technically a brush entity and all world brushes become part of model #0. The head lump of the BSP file if you discount the entities lump. Entities
Nodes The BSP part of BSP file. Each model is subdivided into a tree, and this lump holds info of each node in the tree. Models, Nodes
Leafs The tips of the BSP tree, describing one space. Nodes
Clipnodes A simpler BSP tree structure for Hulls 1-3, used for player collision. Models, Clipnodes
Faces Holds information of all the faces. Models, MarkSurfaces
Planes Holds all the planes used by nodes/leafs/faces. Nodes, Clipnodes, Faces
TexInfo Texture information for a face, in particular, the S and T vectors (related to offset, scale, rotation, and skew). Crunched together with the face vertices to get the lightmap dimensions. Faces
MipTex All textures used in the level. Identical to the same struct in WAD files, and can be embedded using CSG compiler arguments -wadinclude or -nowadtextures. TexInfo
Edges Edges between 2 vertices. Referenced by faces via SurfEdges. SurfEdges
Vertices A point marking vertices of faces. Referenced by edges. Edges
Lightmap A raw linear array of RGB values holding the lightmap of all faces in the map. The size of data read from this lump for each face is calculated rather than specified in the face struct. The RAD compiler computes only this value. Faces
Visibility A compressed bit-field of the VISibility of every other leaf from a reference leaf. The VIS compiler computes only this value. Leafs
MarkSurfaces A redirection layer from leafs to faces Leafs
SurfEdges A redirection layer from faces to edges Faces
The struct properties of each lump and relationship of each lump struct to other lump structs are illustrated below:
Relational model of the lumps in a BSP30Relational model of the lumps in a BSP30
The page Tutorial: Compiler charts and limits contains more detail on each lump, and their limits.

Comments

You must log in to post a comment. You can login or register a new account.