lightmap Last edited 10 months ago2024-02-14 10:59:48 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.
A lightmap is the lighting data associated surfaces in a map. In general, there is 1 point of lighting data (luxel) for every 16 texture pixels (texels) on any particular surface, in both dimensions. The engine interpolates the brightness value between each of the points to give it the smooth lighting effect. For how the size is calculated, see: AllocBlock.

The compile tool HLRAD produces the lightmaps for the map. Lighting can come from either light entities or from texture lighting.

There can be up to 4 different lightmaps applied to a face. Usually all unnamed static lights get baked into the first, then named (i.e. switchable) and animated lighting go to the next ones, but only up to the fourth. The assignment is through the style number: all unnamed static lights are style 0 (normal) lightmap, flourescent flickering lights are style 10 lightmap, and named lights are given style numbers 32 through 62. The style numbers are read from light entities, and for named lights the style numbers are assigned to them at compile time.

For a variety of reasons, the engine uses the AllocBlocks as a place to paint the resulting product of all lighting values, which is then combined with the texture data (and, if available, detail textures). Important to note is that there is a hard limit for AllocBlocks; each is 128x128 luxels, for a maximum of 64 such blocks.

1 Comment

Commented 3 months ago2024-08-30 14:27:21 UTC Comment #106349
If you're curious about how lightmap sizes are calculated, and the techniques used to light those lightmaps, I highly recommend this excellent video:
In Half-Life/GoldSource/VHLT it's more like Q2's QRAD3. Also discussed is Ericw-tools, which you can use on GoldSrc maps (though support is only in alpha as of writing)

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