BSP Last edited 4 months ago2024-06-20 06:04:16 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
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, for a total of 15 lumps:
Lump Description Referenced by
Entities All the entity data from the source .map format.
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. 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 tip of the BSP tree, describing one space. Nodes points to leafs. Nodes
Clipnodes A simpler BSP tree structure for Hulls 1-3, used for player collision. There is no leaf for this structure. Models, Clipnodes
Planes Holds all the planes used by nodes/leafs/faces Nodes, Clipnodes, Faces
Faces Holds all the faces. Each model references a contiguous list of faces. Models, MarkSurface
TexInfo Each face holds a TexInfo for the texture properties. Faces
MipTex All textures used in the level. Can be embedded. TexInfo
Edges Edges between 2 vertices. Referenced by faces. 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
MarkSurface 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 e.g. why you can have only 32767 clipnodes in a .bsp file.

Comments

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