Difference between revisions of "BLMAP (File Format)"

From Custom Mario Kart
Jump to navigation Jump to search
Line 76: Line 76:
 
| 0x05 || x<sup>6</sup> || Exponential gradient between x=32 and x=64
 
| 0x05 || x<sup>6</sup> || Exponential gradient between x=32 and x=64
 
|-
 
|-
| 0x06 || x<sup>7</sup> || Exponential gradient between x=32 and x=64
+
| 0x06 || x<sup>8</sup> || Exponential gradient between x=32 and x=64
 
|-
 
|-
 
| 0x07 || x || Linear gradient between x=4 and x=45
 
| 0x07 || x || Linear gradient between x=4 and x=45

Revision as of 12:36, 5 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. The exact purpose of BLMAP files is currently unknown.

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.

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
0x34 Uint8 Type
0x35 Byte[3] Padding
0x38 Uint32 Length of the following list (N * 8)
0x3C Sub[N] A list of entries with the following structure:
Offset Type Description
0x00 Float Intensity of the lighting (must be between 0.0 and 1.0)
0x04 Uint8 Gradient to use for this entry (see table blow)
0x05 Uint8[3] Unknown.

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