Difference between revisions of "BLIGHT (File Format)"
Line 47: | Line 47: | ||
| 0x0C || Byte[4] || {{Unknown-left|'''Unknown'''. Always 00 00 00 00.}} | | 0x0C || Byte[4] || {{Unknown-left|'''Unknown'''. Always 00 00 00 00.}} | ||
|- | |- | ||
− | | 0x10 || | + | | 0x10 || Byte|| Attenuation angle falloff function |
+ | {|class=wikitable | ||
+ | ! Value !! Description | ||
|- | |- | ||
− | | | + | | 0 || Disabled |
|- | |- | ||
− | | | + | | 1 || Flat (sharp border) |
+ | |- | ||
+ | | 2 || Cosine | ||
+ | |- | ||
+ | | 3 || Cosine with smoother cutoff | ||
+ | |- | ||
+ | | 4 || Sharp, but not as sharp as flat | ||
+ | |- | ||
+ | | 5 || Ring with center dimly illuminated | ||
+ | |- | ||
+ | | 6 || Ring | ||
+ | |} | ||
+ | |- | ||
+ | | 0x11 || Byte|| Attenuation distance falloff function | ||
+ | {|class=wikitable | ||
+ | ! Value !! Description | ||
+ | |- | ||
+ | | 0 || Disabled | ||
+ | |- | ||
+ | | 1 || Gentle | ||
+ | |- | ||
+ | | 2 || Medium | ||
+ | |- | ||
+ | | 3 || Steep | ||
+ | |} | ||
+ | |- | ||
+ | | 0x12 || Byte || Coordinate system for origin and destination | ||
+ | {|class=wikitable | ||
+ | ! Value !! Description | ||
+ | |- | ||
+ | | 1 || World coordinates | ||
+ | |- | ||
+ | | 2 || View coordinates (so rotates with the camera) | ||
+ | |- | ||
+ | | 3 || Top-down view - illuminates from the top of the screen | ||
+ | |- | ||
+ | | 3 || Bottom-up view - illuminates from the bottom of the screen | ||
+ | |} | ||
+ | |- | ||
+ | | 0x13 || Byte || Light type: 00 = omni light, 01 = directional, 02 = spotlight. Always 01 in Nintendo tracks. | ||
|- | |- | ||
| 0x14 || UInt16 || This value stores the index of the [[#Ambient Light data|ambient light]] this light uses. | | 0x14 || UInt16 || This value stores the index of the [[#Ambient Light data|ambient light]] this light uses. | ||
|- | |- | ||
− | | 0x16 || UInt16 || | + | | 0x16 || UInt16 || Bitfield. Always 06 41 (1, 6, 9 and 10) or 06 21 (1, 5, 9 and 10). Unknown values are not included. |
+ | {|class=wikitable | ||
+ | ! Offset !! Byte !! Description | ||
+ | |- | ||
+ | | 0 || 0x1 || Enable direction vectors and colors (disabled for the first entry) | ||
+ | |- | ||
+ | | 1 || 0x2 || Enable direction vector shifting (use coordinates of another light object) | ||
+ | |- | ||
+ | | 6 || 0x40 || Same as 1, both need to be set. | ||
+ | |- | ||
+ | | 7 || 0x80 || Use an attenuation angle curve instead of predefined spot functions. Settings unknown. | ||
+ | |- | ||
+ | | 8 || 0x100 || Use an attenuation distance curve instead of predefined distance functions. Settings unknown. | ||
+ | |- | ||
+ | | 11 || 0x800 || Use an unknown attenuation curve with fixed settings. | ||
+ | |} | ||
|- | |- | ||
| 0x18 || Float[3] || 3D origin vector. | | 0x18 || Float[3] || 3D origin vector. |
Revision as of 00:22, 3 December 2022
The BLIGHT (Binary LIGHT) filetype 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
File Header
The following table describes the version 2 LIGHT header.
Offset | Type | Description |
---|---|---|
0x00 | String | File magic. Always LGHT in ASCII. |
0x04 | UInt32 | File size. Always 0x5A8 in MKW. |
0x08 | Byte | Version. Always 02 in MKW |
0x09 | Byte[3] | Padding. |
0x0C | UInt32 | Unknown. Always 00 00 00 00. |
0x10 | UInt16 | Number of LOBJs. Always 0x10 in MKW. |
0x12 | UInt16 | Number of Ambient Lights. Always 0x10 in MKW. |
0x14 | Byte[4] | RGBA ambience black color. Always 00 00 00 FF. |
0x18 | Byte[16] | 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)
The first light object starts at 0x28. These addresses are relative to the start of the object.
Offset | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x00 | String | Section magic. Always LOBJ in ASCII. | |||||||||||||||||||||
0x04 | UInt32 | Section size. Always 0x50. | |||||||||||||||||||||
0x08 | Byte | Version. Always 02 in MKW, except for loser_demo and draw_demo, in which said value is 01. | |||||||||||||||||||||
0x09 | Byte[3] | Padding. | |||||||||||||||||||||
0x0C | Byte[4] | Unknown. Always 00 00 00 00. | |||||||||||||||||||||
0x10 | Byte | Attenuation angle falloff function
| |||||||||||||||||||||
0x11 | Byte | Attenuation distance falloff function
| |||||||||||||||||||||
0x12 | Byte | Coordinate system for origin and destination
| |||||||||||||||||||||
0x13 | Byte | Light type: 00 = omni light, 01 = directional, 02 = spotlight. Always 01 in Nintendo tracks. | |||||||||||||||||||||
0x14 | UInt16 | This value stores the index of the ambient light this light uses. | |||||||||||||||||||||
0x16 | UInt16 | Bitfield. Always 06 41 (1, 6, 9 and 10) or 06 21 (1, 5, 9 and 10). Unknown values are not included.
| |||||||||||||||||||||
0x18 | Float[3] | 3D origin vector. | |||||||||||||||||||||
0x24 | Float[3] | 3D destination vector. | |||||||||||||||||||||
0x30 | Float | This seems to control how large the color effect is on this light. | |||||||||||||||||||||
0x34 | Byte[4] | RGBA light color. | |||||||||||||||||||||
0x38 | UInt32 | Unknown. Always 00 00 00 FF. | |||||||||||||||||||||
0x3C | Float | Unknown. Always 42 B4 00 00, 90 in float. | |||||||||||||||||||||
0x40 | Float | Unknown. Always 3F 00 00 00, 0.5 in float. | |||||||||||||||||||||
0x44 | Float | Unknown. Always 3F 00 00 00?, 0.5 in float. | |||||||||||||||||||||
0x48 | UInt64 | Padding? Nearly always 00 00 00 00 00 00 00 00. Sometimes it's 00 00 00 FF 00 00 00 00 on the last light. | |||||||||||||||||||||
0x50 | End of object, start of next |
Ambient Light data
Ambient colors are used by each light object. They are linked by a light.
Offset | Type | Information |
---|---|---|
0x00 | Byte[4] | RGBA ambient light color. |
0x04 | UInt32 | Padding. |
0x08 | End of color, start of next |
All unused ones are 64 64 64 FF (a neutral gray).
Tools
The following tools can handle BLIGHT files:
- Post-Effect Editor, by Wexos
- Wexos's Toolbox, by Wexos.