Lights (Metroid Prime)

From Retro Modding Wiki
Revision as of 15:54, 9 March 2015 by >Aruki
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 Unknown Used as a color multiplier for local ambient, and used to calculate attenuation for spot/custom.
0x2C float Spot Cutoff
0x30 float Unknown
0x34 byte Quadratic Cutoff
0x35 float Light Factor
0x39 long Unknown Modifies how attenuation is calculated. Possible values range from 0-2.
0x3D float Unknown
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