Difference between revisions of "BLIGHT (File Format)"

From Custom Mario Kart
Jump to navigation Jump to search
m (wrong category ref)
Line 47: Line 47:
 
| 0x08 || 0x08 || Unknown value || (always 02 00 00 00 00 00 00 00)
 
| 0x08 || 0x08 || Unknown value || (always 02 00 00 00 00 00 00 00)
 
|-
 
|-
| 0x10 || 0x02 || Unknown value ||  
+
| 0x10 || 0x02 || Unknown value || (always 00 00?)
 
|-
 
|-
| 0x10 || 0x01 || Unknown || Always 00 on unused/undefined lights, but 01 and 02 on used ones.
+
| 0x12 || 0x01 || Unknown || Always 00 on unused/undefined lights, 02 most common, 01 (CCW) and 04 (RR, TD) seen.
 
|-
 
|-
| 0x10 || 0x01 || Unknown value || Always 00
+
| 0x13 || 0x01 || Unknown value || Always 01
 
|-
 
|-
 
| 0x14 || 0x02 || Light ID || The ID used here is referenced in KCL files, and also matches the ambient lights at the end of the BLIGHT.
 
| 0x14 || 0x02 || Light ID || The ID used here is referenced in KCL files, and also matches the ambient lights at the end of the BLIGHT.
Line 57: Line 57:
 
| 0x16 || 0x02 || Unknown value || (always 06 41)
 
| 0x16 || 0x02 || Unknown value || (always 06 41)
 
|-
 
|-
| 0x18 || 0x04x3 (0x0C) || Angle of light || This is a vector. All values are in float point. Angle is relative to viewing angle.
+
| 0x18 || 0x04x3 (0x0C) || 3D origin vector (X = 80566.406 Y = 55000.0 Z = 100000.0 in LC)
 
|-
 
|-
| 0x24 || 0x04 || Unknown value || (always 00 00 00 00)
+
| 0x24 || 0x04x3 (0x0C) || 3D destination vector (X = 51367.188 Y = 41015.625 Z = 11865.234 in LC)
 
|-
 
|-
| 0x28 || 0x04 || Unknown value || (always 00 00 00 00)
+
| 0x30 || 0x04 (Float) || Scale? || (always 3F 80 00 00, 1 in float)
|-
 
| 0x2C || 0x04 || Unknown value || (always 00 00 00 00, these three might be a vector?)
 
|-
 
| 0x30 || 0x04 (Float) || Unknown value || (always 3F 80 00 00)
 
 
|-
 
|-
 
| 0x34 || 0x04 || '''RGBA''' Light Color || (RR GG BB AA)
 
| 0x34 || 0x04 || '''RGBA''' Light Color || (RR GG BB AA)
Line 73: Line 69:
 
| 0x3C || 0x04 (Float) || Unknown Value || (Part of another vector? Always 42 B4 00 00, 90 in float point)
 
| 0x3C || 0x04 (Float) || Unknown Value || (Part of another vector? Always 42 B4 00 00, 90 in float point)
 
|-
 
|-
| 0x40 || 0x04 (Float) || Unknown Value || (Always 3F 00 00 00?)
+
| 0x40 || 0x04 (Float) || Unknown Value || (Always 3F 00 00 00?) (0.5 in float point)
 
|-
 
|-
| 0x44 || 0x04 (Float) || Unknown Value || (Always 3F 00 00 00?)
+
| 0x44 || 0x04 (Float) || Unknown Value || (Always 3F 00 00 00?) (0.5 in float point)
 
|-
 
|-
 
| 0x48 || 0x08 || Padding? || (always 00 00 00 00 00 00 00 00, unless it is the last light. In that case, it's 00 00 00 FF 00 00 00 00)
 
| 0x48 || 0x08 || Padding? || (always 00 00 00 00 00 00 00 00, unless it is the last light. In that case, it's 00 00 00 FF 00 00 00 00)
Line 81: Line 77:
 
| {{unknown|0x50}} || colspan=3 {{unknown|End of object, start of next}}
 
| {{unknown|0x50}} || colspan=3 {{unknown|End of object, start of next}}
 
|}
 
|}
 
  
 
== Ambient Light data ==
 
== Ambient Light data ==

Revision as of 13:55, 27 May 2015

The BLIGHT (Binary light controller) filetype controls lighting effects on characters, karts, items and objects in a track. It is always seen in the "./posteffect" folder inside an SZS. This file is not required for a track to load, as there is a "default.blight" file inside Common.szs.


File Header

Header is:

Offset size description Extra Information
0x00 0x04 "BGHT" magic
0x04 0x04 File size (always 00 00 05 A8)
0x08 0x04 Unknown value (seen as 02 00 00 00 in Bowser's Castle)
0x0C 0x04 or [2x]0x02 Unknown values (always 00 00 00 00?)
0x10 [2x]0x02 Unknown values (seen as 00 10 00 10 in Bowser's Castle), possibly number of lights, and number of ambient lights
0x14 0x04 Unknown value (always 00 00 00 FF?)
0x18 0x0F Padding

However, one thing to note is that although 16 lights are stored in this file, only 8 can be referenced by the KCL (IDs 00 to 07). This is because the KCL only has three binary digits to reference lights (and 111 in binary = 7).


Light Object data (LOBJ)

Here is one Light Object.

LOBJ file inside the BLIGHT file

The first object starts at 0x28.

These addresses are relative to the start of the object.

Offset size description Extra Information
0x00 0x04 The magic, LOBJ (always 4C 4F 42 4A, spells LOBJ in ASCII)
0x04 0x04 Size of this LOBJ (always 00 00 00 50)
0x08 0x08 Unknown value (always 02 00 00 00 00 00 00 00)
0x10 0x02 Unknown value (always 00 00?)
0x12 0x01 Unknown Always 00 on unused/undefined lights, 02 most common, 01 (CCW) and 04 (RR, TD) seen.
0x13 0x01 Unknown value Always 01
0x14 0x02 Light ID The ID used here is referenced in KCL files, and also matches the ambient lights at the end of the BLIGHT.
0x16 0x02 Unknown value (always 06 41)
0x18 0x04x3 (0x0C) 3D origin vector (X = 80566.406 Y = 55000.0 Z = 100000.0 in LC)
0x24 0x04x3 (0x0C) 3D destination vector (X = 51367.188 Y = 41015.625 Z = 11865.234 in LC)
0x30 0x04 (Float) Scale? (always 3F 80 00 00, 1 in float)
0x34 0x04 RGBA Light Color (RR GG BB AA)
0x38 0x04 Unknown Value (always 00 00 00 FF)
0x3C 0x04 (Float) Unknown Value (Part of another vector? Always 42 B4 00 00, 90 in float point)
0x40 0x04 (Float) Unknown Value (Always 3F 00 00 00?) (0.5 in float point)
0x44 0x04 (Float) Unknown Value (Always 3F 00 00 00?) (0.5 in float point)
0x48 0x08 Padding? (always 00 00 00 00 00 00 00 00, unless it is the last light. In that case, it's 00 00 00 FF 00 00 00 00)
0x50 End of object, start of next

Ambient Light data

At 0x0528 in the file, a list of colors starts, separated by four 00's. These are the ambient colors used by each light. They're in order, and their IDs are from 00 to 0F (matches the main lights above).

Offset Length Information
0x00 0x04 RGBA Ambient Light Color
0x04 0x04 Padding
0x08 Start of next color

Just like light objects, there are 16 ambient colors. All unused ones are 64 64 64 FF (a neutral gray).


Known .BLIGHT files

default.blight (in Common.szs)
posteffect.blight (in every course SZS file)