Format:BSP (Quake III)
| Developer | id Software |
|---|---|
| Versions | 46 (Quake III Arena) |
| Magic | 49 42 53 50 ("IBSP") then int32 46 |
| Extensions | .bsp |
| Endianness | little |
| On this wiki | Facts · Code · Notes · Topics |
Compiled map format of Quake III Arena and many derived engines (IBSP, version 46): 17 lumps, shaders instead of texinfo, bezier patches, 128x128 lightmaps and a light grid; Return to Castle Wolfenstein and others use version 47 variants.
Identification
49 42 53 50 ("IBSP") followed by int32 BSP_VERSION 46. Quake II has the same magic with version 38 (Format:BSP (Quake II)); versions 47 and above in other games are variants (not covered; Unverified).
Header
dheader_t { int ident; int version; lump_t lumps[17]; } (8 + 17*8 = 144 bytes), lump_t {int fileofs, filelen}.
Lumps: 0 entities, 1 shaders, 2 planes, 3 nodes, 4 leafs, 5 leafsurfaces, 6 leafbrushes, 7 models, 8 brushes, 9 brushsides, 10 drawverts, 11 drawindexes, 12 fogs, 13 surfaces, 14 lightmaps, 15 lightgrid, 16 visibility.
Records
- shader: char shader[64], int surfaceFlags, int contentFlags (72 bytes); the name is a path used to look up a shader script, not an image
- plane: float normal[3], float dist; node: int planeNum, children[2] (negative = -(leaf+1)), int mins[3], maxs[3] (36 bytes)
- leaf: int cluster, area, mins[3], maxs[3], firstLeafSurface, numLeafSurfaces, firstLeafBrush, numLeafBrushes (48 bytes)
- model: float mins[3], maxs[3], int firstSurface, numSurfaces, firstBrush, numBrushes (40 bytes)
- brush: int firstSide, numSides, shaderNum; brushside: int planeNum, shaderNum; fog: char shader[64], int brushNum, visibleSide
- drawVert: xyz[3], st[2], lightmap[2], normal[3] floats and byte color[4] (44 bytes)
- surface (104 bytes): shaderNum, fogNum, surfaceType, firstVert, numVerts, firstIndex, numIndexes, lightmapNum, lightmapX, lightmapY, lightmapWidth, lightmapHeight, float lightmapOrigin[3], lightmapVecs[3][3], int patchWidth, patchHeight
- surfaceType: 0 bad, 1 planar, 2 patch (bezier control grid patchWidth x patchHeight), 3 triangle soup, 4 flare
- lightmaps: 128x128 RGB (49152 bytes each); the lump is simply an array of them
Limits: 1024 models, 32768 brushes, 2048 entities, 1024 shaders, 131072 planes/nodes/leafs, 262144 leafbrushes, 524288 draw verts/indexes, world coordinates +-131072.
The light grid and visibility lump layouts are not in qfiles.h (they are in the tools); the visibility lump starts with int numClusters and int clusterBytes, then numClusters x clusterBytes bytes of uncompressed bit rows: the renderer's R_LoadVisibility (code/renderer/tr_bsp.c lines 232-260) reads the two ints from the first 8 bytes and copies the remaining filelen - 8 bytes as the vis data. A zero-length lump means no visibility (all clusters visible).
Related
Models: Format:MD3 (Quake III). Game data ships in .pk3 files, which are plain ZIP archives, see Format:PK3 (Quake III) (read in code/qcommon/files.c). Game modules: Format:QVM (Quake III).
Code & repositories
- https://github.com/id-Software/Quake-III-Arena @
dbe4ddb10315479fc00086f08e25d968b4b43c49· license: GPL-2.0-or-later (declared by the contributor for the files used; GitHub reports GPL-2.0 for the repository)
GPL release of the Quake III Arena source; code/qcommon/qfiles.h defines BSP v46 and MD3/MD4 on-disk structures.
Tested on: source read, not run: source read, not built: code/qcommon/qfiles.h at commit dbe57e3 · checked 2026-10-18; last activity 2024-08-02
Evidence & references
id-Software/Quake-III-Arena code/qcommon/qfiles.h at commit dbe57e3 (GPL-2.0-or-later).