ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.


From ModEnc
Jump to: navigation, search

Voxels.vpl is a file used to determine the final in-game color of a voxel, adjusted by its surface normal.


VPL contains 32 sections, meaning 32 possible configurations for each of the 256 voxel color indexes (in unittem.pal). In Tiberian Sun, only the first 16 sections are actually used. The purpose of these configurations is to gradually change the brightness of the voxel's color when the voxel rotates. The first section is used when the normal is facing directly opposite to the imagined light source, therefore appearing the darkest. Conversely, the last section is used when the normal is pointing directly at the light source, thus appearing the brightest. Should the total amount of sections be anything less than 32 (see the VPL header below), the voxel will become transparent when its normal points to the missing section(s).


The VPL file consists of a header, a redundant palette, and 32 sections. The header is 16 bytes long, composed of the following data, all DWORDs:

- first remap color index
- last remap color index
- total amount of sections (1–32)
- an unknown entry at the time of writing

The header is followed by a Westwood-standard 768-byte palette which is followed by 32 sections, each 256 bytes long. These sections are mere lookup tables, each byte representing the index of a color in the voxel color palette (unittem.pal). While there is a palette in the VPL, it's ignored by the engine.

See also

Original research thread at PPM Forums