AllocBlock Last edited 10 months ago2024-01-27 12:49:57 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.
An AllocBlock refers to a type of texture internal to the GoldSrc engine. If you're familiar with 3D graphics rendering, the term texture atlas might be familiar to you. AllocBlock is that, but for the lightmaps in a map. Each block is 128x128 lighting pixels (henceforth called luxels) in size, and there is a maximum of 64 of them at any one time.

On loading a map, the game engine allocates for every face in a map a small piece of an AllocBlock texture to paint on the lighting from the lightmaps stored in the map file for the face. This gets allocated for qualifying faces [note 1] no matter the lighting styles attached to it. The scale of this mapped face on the AllocBlock is 1/16th the scale of the texture on the face for each side. That means if the total texture area on the face is 128x128, the allocated block is 8x8 (or 9x9, depends on the texture shift.) The engine does this for every face in the map, filling up up to 64 of such AllocBlocks.

On rendering a frame, the engine applies lightmaps (after modulating animated ones and combining overlapping styles) to the AllocBlocks, then projects the assigned parts to the faces to be combined with the textures and [if supported and available] the detail textures.

The dreaded AllocBlock:Full error occurs when the engine runs out of these 64 AllocBlocks, and there's still faces left over. Simply put, it's because there's too many texture pixelage in your map. It can happen accidentally, like having scale lock on while resizing down brushes, or transforming brushes that result in textures perpendicular to the face, in which case you should go fix it. When accidental tiny scaled faces are eliminated but AllocBlocks are still over budget, then texture scale should start getting budgeted, by increasing the scale on certain faces which reduces the total number of texels (and the corresponding luxels). The brushwork should also be optimized to reduce cutting across diagonals, which creates triangular faces. [note 2]

AllocBlocks are purely a construct inside the engine, but the impact is notable enough that modern compile tools like VHLT simulates allocating faces to AllocBlocks to measure the number of AllocBlocks a map would use if the engine loads it.
Notes
  1. User posted image sky, faces of !liquids, and faces marked special are discounted. This lead to slight waste of lightmaps on those generated on !liquids.
  2. Triangular faces wastes AllocBlocks as the full bounding rectangle is allocated instead. A rectangular cut diagonally (viz. ◩) uses twice the AllocBlock as an intact rectangle.

Comments

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