BLIGHT (File Format)

From Wexos's Wiki
Revision as of 17:12, 1 May 2024 by Wexos (talk | contribs) (Imported from avsys wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The BLIGHT (Binary LIGHT) file format in Mario Kart Wii controls lighting effects on characters, karts, items and objects in a track. 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.blight file inside Common.szs.

File Format

The file byte order is always big endian.

File Header

The following table describes the version 2 LIGHT header.

Offset Type Description
0x00 Char[4] File magic. Always LGHT in ASCII.
0x04 UInt32 File size.
0x08 UInt32 Version. Always 2.0.0.0 in Mario Kart Wii.
0x0C UInt32 Unknown. Always 00 00 00 00.
0x10 UInt16 Number of LOBJs.
0x12 UInt16 Number of ambient colors.
0x14 Byte Unknown. Always 00
0x15 Byte Unknown. Always 00
0x16 Byte Unknown. Always 00
0x17 Byte Unknown. Always FF
0x18 Byte[16] Unknown.

LOBJ

The first light object starts at 0x28. Each entry has the following structure.

Offset Type Description
0x00 Char[4] Section magic. Always LOBJ in ASCII.
0x04 UInt32 Section size. Always 0x50.
0x08 UInt32 Version. Always 2.0.0.0 in Mario Kart Wii.
0x0C UInt32 Unknown. Always 00 00 00 00.
0x10 Byte Spot function.
0x11 Byte Distance attenuation function.
0x12 Byte Unknown. Usually 00 on unused lights, 02 most common. 01 and 04 has also been seen seen.
0x13 Byte Light type.
0x14 UInt16 Ambient color index.
0x16 UInt16 Flag. xxxx xGFE DCBx xxxA.
  • A: enable.
  • B: enable G3D.
  • C: enable GX.
  • D: enable cut-off.
  • E: use manual distance attenuation.
  • F: enable G3D color.
  • G: enable G3D alpha.
0x18 Float[3] Light position.
0x24 Float[3] Aim.
0x30 Float Intensity.
0x34 Byte[4] Light color in RGBA format.
0x38 Byte[4] Specular color in RGBA format.
0x3C Float Specular cut-off angle in degrees.
0x40 Float Distance reference.
0x44 Float Brightness reference.
0x48 UInt32 Unknown.
0x4C UInt32 Unknown.

Ambient Color

Ambient colors are used by each light object. Each entry has the following structure:

Offset Type Information
0x00 Byte[4] RGBA ambient light color.
0x04 UInt32 Unknown.

Tools

The following tools can handle BLIGHT files: