BLMAP (File Format)
The BLMAP (Binary Light MAP) filetype controls lighting mapping. It is always seen in the posteffect folder inside an U8. This file is not required for a track to load, as there is a default.blmap file inside Common.szs. BLMAP files control how the BLIGHT lighting reflects off a linked texture, determining how shiny a surface is. It does so by creating a spherical displacement map and a gradient. The type of gradient determines the drop-off from the fully illuminated side of the sphere to the ambient color. The generated 32x32 grayscale sphere-shaped texture then replaces the original.
File Format
File Header
The following table describes the LIGHT header.
Offset | Type | Description |
---|---|---|
0x00 | String | File magic. Always LMAP in ASCII. |
0x04 | UInt32 | File size. Always 0x298 in MKW. |
0x08 | UInt8 | Version. Always 00 in MKW. |
0x0C | UInt32 | Unknown. Always 00 00 00 00. |
0x10 | Uint16 | Number of LTEXs. Always 0x02 in MKW. |
0x12 | Byte[14] | Padding. |
Light Texture data (LTEX)
The first object starts at 0x20. These addresses are relative to the start of the object. The object contains a list whereby each entry acts as a shader stage where the linked light is applied. Each entry sets its own gradient type. Each entry therefore applies permanent simulated lighting to the object with the given texture.
Offset | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x00 | String | Section magic. Always LTEX in ASCII. | ||||||||||||
0x04 | UInt32 | Section size. Always 0x13C. | ||||||||||||
0x08 | Uint8 | Version. Always 00 in MKW. | ||||||||||||
0x09 | Byte[3] | Padding | ||||||||||||
0x0C | Uint32 | Unknown. | ||||||||||||
0x10 | Uint16 | Number of subobjects (N). Always 0x20. | ||||||||||||
0x14 | Char[32] | Name of the texture this entry must be linked to. Linked textures must start with lm_. | ||||||||||||
0x34 | Uint8 | Type: 0 = Spherical gradient (illuminated from 4 sides), 1 = Flat gradient (just a regular gradient texture), 2 = spherical gradient (illuminated from 1 side) | ||||||||||||
0x35 | Byte[3] | Padding | ||||||||||||
0x38 | Uint32 | A bitfield describing which entries are activated (Nth bit set = Nth entry activated). Always 0x100 (only 8th entry) in Nintendo tracks. | ||||||||||||
0x3C | Sub[N] | A list of entries with the following structure:
|
Gradients
Each LTEX entry links to a 64x4 grayscale black to white gradient texture. The table below lists the different kind of gradients.
id | Type | Description |
---|---|---|
0x00 | x | Linear gradient between x=32 and x=64 |
0x01 | x | Linear gradient between x=0 and x=64 |
0x02 | x | Linear gradient between x=16 and x=64 |
0x03 | x2 | Quadratic gradient between x=32 and x=64 |
0x04 | x4 | Quartic gradient between x=32 and x=64 |
0x05 | x6 | Sextic gradient between x=32 and x=64 |
0x06 | x8 | Octic gradient between x=32 and x=64 |
0x07 | x | Linear gradient between x=4 and x=45 |
0x08 | -x2 | Negative quadratic gradient between x=10 and x=42 |
0x09 | -x2 | Negative quadratic gradient between x=13 and x=45 |
Tools
The following tools can handle BLMAP files:
- Post-Effect Editor, by Wexos
- RiiStudio, by Riidefi