Difference between revisions of "Lights (Metroid Prime)"

From Retro Modding Wiki
Jump to: navigation, search
m
(Light)
Line 41: Line 41:
 
| 0x28
 
| 0x28
 
| float
 
| float
| {{unknown|'''Unknown'''}}
+
| '''Multiplier'''
| Used as a color multiplier for local ambient, and used to calculate attenuation for spot/custom.
+
| Color multiplier for local ambient, used to calculate attenuation coefficients for spot/custom
 
|-
 
|-
 
| 0x2C
 
| 0x2C
Line 52: Line 52:
 
| float
 
| float
 
| {{unknown|'''Unknown'''}}
 
| {{unknown|'''Unknown'''}}
|  
+
| Possibly unused
 
|-
 
|-
 
| 0x34
 
| 0x34
 
| byte
 
| byte
| '''Quadratic Cutoff'''
+
| {{unknown|'''Unknown'''}}
|  
+
| Possibly unused
 
|-
 
|-
 
| 0x35
 
| 0x35
 
| float
 
| float
| '''Light Factor'''
+
| {{unknown|'''Unknown'''}}
|  
+
| Possibly unused
 
|-
 
|-
 
| 0x39
 
| 0x39
 
| long
 
| long
| {{unknown|'''Unknown'''}}
+
| '''Falloff Type'''
| Modifies how attenuation is calculated. Possible values range from 0-2.
+
| Possible values: 0 - Constant; 1 - Linear; 2 - Quadratic
 
|-
 
|-
 
| 0x3D
 
| 0x3D
 
| float
 
| float
 
| {{unknown|'''Unknown'''}}
 
| {{unknown|'''Unknown'''}}
|  
+
| Possibly unused
 
|-
 
|-
 
| 0x41
 
| 0x41

Revision as of 17:05, 10 March 2015

The Lights section in Metroid Prime areas defines several different types of lights: spot, point, directional, and custom. The exact behavior for each type of light is not entirely known, however they all use the same struct. The only difference is how they're utilized by the engine.


Morphball wirerender.png This file format needs more research
Need to research meaning behind remaining unknowns


Format

The header for the light section is extremely simple and consists of the magic value 0xBABEDEAD. It's then followed by two arrays of lights, each preceded by a light count.

Light

Each light is a 0x41-byte struct that consists of the following data:

Offset Type Description Notes
0x0 long Light Type
0x4 float3 Light Color
0x10 float3 Position
0x1C float3 Direction
0x28 float Multiplier Color multiplier for local ambient, used to calculate attenuation coefficients for spot/custom
0x2C float Spot Cutoff
0x30 float Unknown Possibly unused
0x34 byte Unknown Possibly unused
0x35 float Unknown Possibly unused
0x39 long Falloff Type Possible values: 0 - Constant; 1 - Linear; 2 - Quadratic
0x3D float Unknown Possibly unused
0x41 End of light

Light Types

The first value in each light is a type value. These are the possible values:

Type Name
0x0 Local Ambient
0x1 Directional
0x3 Spot
Other Custom