Lights (Metroid Prime): Difference between revisions

From Retro Modding Wiki
Jump to navigation Jump to search
>Aruki
(→‎Format: Adding new info, marking stuff that isn't 100% certain as unknown because I suspect some of it is likely wrong)
>Aruki
m (→‎Light Types: Removing some info that might not be accurate for now)
Line 98: Line 98:
| Custom
| Custom
|}
|}
The game doesn't actually track separate light types internally; rather, each light type is a preset that only draws from a couple of the possible parameters. The Custom type is not a preset, and allows further control over how the light is set up. Custom lights are commonly found under type 0x2, acting as point/omni lights.


[[Category:File Formats]]
[[Category:File Formats]]

Revision as of 15:54, 9 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.


This file format needs a lot of 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