Lights (Metroid Prime)

From Retro Modding Wiki
Revision as of 23:05, 10 March 2015 by >Aruki (→‎Light)
Jump to navigation Jump to search

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.


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