Difference between revisions of "BLMAP (File Format)"
m (→Gradients) |
|||
Line 1: | Line 1: | ||
− | The '''BLMAP''' ('''B'''inary '''L'''ight '''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 [[Filesystem/Race/Common.szs|Common.szs]]. The | + | The '''BLMAP''' ('''B'''inary '''L'''ight '''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 [[Filesystem/Race/Common.szs|Common.szs]]. BLMAP files control how the [[BLIGHT (File Format)|BLIGHT]] lighting reflects off a linked texture. It does so by creating a spherical displacement map and a gradient. The type of gradient determines the dropoff 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 Format = | ||
Line 21: | Line 21: | ||
== Light Texture data (LTEX) == | == Light Texture data (LTEX) == | ||
− | The first object starts at 0x20. These addresses are relative to the start of the object. | + | 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 therefor applies permanent simulated lighting to the object with the given texture. |
{|class=wikitable | {|class=wikitable | ||
Line 38: | Line 38: | ||
| 0x10 || Uint16 || Number of subobjects ('''N'''). Always 0x20. | | 0x10 || Uint16 || Number of subobjects ('''N'''). Always 0x20. | ||
|- | |- | ||
− | | 0x14 || Char[32] || Name of the texture this entry must be linked to | + | | 0x14 || Char[32] || Name of the texture this entry must be linked to. Linked textures must start with ''lm_''. |
|- | |- | ||
| 0x34 || Uint8 || Type | | 0x34 || Uint8 || Type | ||
Line 44: | Line 44: | ||
| 0x35 || Byte[3] || Padding | | 0x35 || Byte[3] || Padding | ||
|- | |- | ||
− | | 0x38 || Uint32 || | + | | 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: | | 0x3C || Sub['''N'''] || A list of entries with the following structure: | ||
Line 50: | Line 50: | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || Float || Intensity of the lighting (must be between 0.0 and 1.0) | + | | 0x00 || Float || Intensity of the lighting of this stage (must be between 0.0 and 1.0) |
|- | |- | ||
− | | 0x04 || Uint8 || Gradient to use for this entry (see table | + | | 0x04 || Uint8 || Gradient to use for this entry (see table below) |
|- | |- | ||
| 0x05 || Uint8[3] || {{Unknown-left|'''Unknown'''}}. | | 0x05 || Uint8[3] || {{Unknown-left|'''Unknown'''}}. |
Revision as of 16:09, 6 December 2022
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. It does so by creating a spherical displacement map and a gradient. The type of gradient determines the dropoff 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 therefor 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. Always 00 00 00 00. | ||||||||||||
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 | ||||||||||||
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 | Exponential gradient between x=32 and x=64 |
0x04 | x4 | Exponential gradient between x=32 and x=64 |
0x05 | x6 | Exponential gradient between x=32 and x=64 |
0x06 | x8 | Exponential gradient between x=32 and x=64 |
0x07 | x | Linear gradient between x=4 and x=45 |
0x08 | -x2 | Inverse exponential gradient between x=10 and x=42 |
0x09 | -x2 | Inverse exponential gradient between x=13 and x=45 |