Lights (Metroid Prime): Difference between revisions
Jump to navigation
Jump to search
no edit summary
>Aruki No edit summary |
>Aruki No edit summary |
||
Line 1: | Line 1: | ||
The '''lights''' section in Metroid Prime areas defines several different types of lights: local ambient, directional, spot, and custom. Every light type has the same structure in the file; however, different types are utilized in different ways by the engine | The '''lights''' section in Metroid Prime areas defines several different types of lights: local ambient, directional, spot, and custom. Every light type has the same structure in the file; however, different types are utilized in different ways by the engine. | ||
{{research|minor|Lights are mostly figured out; the remaining unknowns are very likely unused, because the game's code never accesses them or passes them to the main light class, but it would be good to have some double-checking.}} | {{research|minor|Lights are mostly figured out; the remaining unknowns are very likely unused, because the game's code never accesses them or passes them to the main light class, but it would be good to have some double-checking. There's also more unknowns in the Prime 3 lights format that probably -are- used.}} | ||
__TOC__ | __TOC__ | ||
Line 9: | Line 9: | ||
The header for the light section is extremely simple and consists of the magic value <code>0xBABEDEAD</code>. It's then followed by two arrays of lights, each preceded by a light count. | The header for the light section is extremely simple and consists of the magic value <code>0xBABEDEAD</code>. It's then followed by two arrays of lights, each preceded by a light count. | ||
=== | === Metroid Prime 1/2 === | ||
Each light is a 0x41-byte struct. Note that the same structure is used for every light type, but not every value is used by every type; in fact, some of them aren't used by any of them. | Each light is a 0x41-byte struct. Note that the same structure is used for every light type, but not every value is used by every type; in fact, some of them aren't used by any of them. | ||
Line 27: | Line 27: | ||
| float3 | | float3 | ||
| '''Light Color''' | | '''Light Color''' | ||
| | | There is no alpha component. | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 55: | Line 55: | ||
|- | |- | ||
| 0x34 | | 0x34 | ||
| | | bool | ||
| {{unknown|'''Unknown'''}} | | {{unknown|'''Unknown'''}} | ||
| Possibly unused | | Possibly unused | ||
Line 75: | Line 75: | ||
|- | |- | ||
| 0x41 | | 0x41 | ||
| colspan=3 {{unknown|End of light}} | |||
|} | |||
=== Metroid Prime 3 === | |||
Prime 3's light format is very similar, but there's a number of new fields introduced (most of which are currently unknown). | |||
{| class="wikitable" | |||
! Offset | |||
! Type | |||
! Description | |||
! Notes | |||
|- | |||
| 0x0 | |||
| long | |||
| '''Light Type''' | |||
| | |||
|- | |||
| 0x4 | |||
| float4 | |||
| '''Light Color''' | |||
| This color ''does'' have an alpha component, unlike Prime 1 lights. | |||
|- | |||
| 0x14 | |||
| float3 | |||
| '''Position''' | |||
| | |||
|- | |||
| 0x20 | |||
| float3 | |||
| '''Direction''' | |||
| | |||
|- | |||
| 0x2C | |||
| float3 | |||
| '''Codirection''' | |||
| The light's up vector | |||
|- | |||
| 0x38 | |||
| float | |||
| '''Multiplier''' | |||
| Color multiplier for local ambient, used to calculate attenuation coefficients for spot/custom | |||
|- | |||
| 0x3C | |||
| float | |||
| '''Spot Cutoff''' | |||
| | |||
|- | |||
| 0x40 | |||
| float | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x44 | |||
| bool | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x45 | |||
| float | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x49 | |||
| u32 | |||
| Falloff Type | |||
| | |||
|- | |||
| 0x4D | |||
| float | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x51 | |||
| float | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x55 | |||
| float | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x59 | |||
| float | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x5D | |||
| float | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x61 | |||
| u32 | |||
| {{unknown|'''Unknown'''}} | |||
| | |||
|- | |||
| 0x65 | |||
| colspan=3 {{unknown|End of light}} | | colspan=3 {{unknown|End of light}} | ||
|} | |} |