MREA (Metroid Prime): Difference between revisions

Jump to navigation Jump to search
no edit summary
>Aruki
No edit summary
>Aruki
No edit summary
Line 4: Line 4:


{{todo|There's a LOT of sections that are mostly known, but need some documentation written up. SCLY and collision need separate articles (although the unique parts of the collision format, like the octree, could maybe be documented here). The rest should probably stay on this page.}}
{{todo|There's a LOT of sections that are mostly known, but need some documentation written up. SCLY and collision need separate articles (although the unique parts of the collision format, like the octree, could maybe be documented here). The rest should probably stay on this page.}}
{{research|2|There's a lot of unknowns in the lights section, and we don't know what the unknown/empty sections are for. That's not even touching on how much is unknown in SCLY.}}
{{research|minor|Discounting unknowns within the actual data sections, the only things that aren't known are what the .}}


== Format ==
== Format ==
Line 14: Line 14:
{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 4
| u32
| '''Magic'''; always 0xDEADBEEF
| 1
| '''Magic'''
| Always <code>0xDEADBEEF</code>.
|-
|-
| 0x4
| 0x4
| 4
| u32
| '''Version'''; see [[MREA (File Format)|hub article]]
| 1
| '''Version'''
| See [[MREA (File Format)|hub article]] for a list of possible version numbers.
|-
|-
| 0x8
| 0x8
| 4 &times; 12
| float
| '''Transform matrix'''
| 12
| '''Area Transform'''
| Matrix that represents the area's transform from the origin. Most area data is pre-transformed, so this matrix is only used occasionally.
|-
|-
| 0x38
| 0x38
| 4
| u32
| '''Mesh count'''
| 1
| '''World Model Count'''
| Number of world models in this area.
|-
|-
| 0x3C
| 0x3C
| 4
| u32
| '''Section count''' (SC)
| 1
| '''Data Section Count'''
| Number of data sections in the file.
|-
|-
| 0x40
| 0x40
| 4
| u32
| '''Geometry section number''' (starts on materials)
| 1
| '''World Geometry Section'''
| Section index for [[#World Geometry|world geometry data]]. Always 0; starts on materials.
|-
|-
| 0x44
| 0x44
| 4
| u32
| '''SCLY section number'''
| 1
| '''Script Layers Section'''
| Section index for [[#Script Layers|script layer data]].
|-
|-
| 0x48
| 0x48
| 4
| u32
| '''Collision section number'''
| 1
| '''Collision Section'''
| Section index for [[#Collision|collision data]].
|-
|-
| 0x4C
| 0x4C
| 4
| u32
| '''Unknown section number'''
| 1
| '''Unknown Section'''
| Section index for [[#Unknown Section|unknown data]].
|-
|-
| 0x50
| 0x50
| 4
| u32
| '''[[Lights_(Metroid_Prime)|Light]] section number'''
| 1
| '''Lights Section'''
| Section index for [[#Lights|light data]].
|-
|-
| 0x54
| 0x54
| 4
| u32
| '''VISI section number'''
| 1
| '''Visibility Tree Section'''
| Section index for [[#Visibility Tree|visibility tree data]].
|-
|-
| 0x58
| 0x58
| 4
| u32
| '''PATH section number'''
| 1
| '''Path Section'''
| Section index for [[#Path|path data]].
|-
|-
| 0x5C
| 0x5C
| 4
| u32
| '''[[AROT (MREA Section)|AROT]] section number'''
| 1
| '''Area Octree Section'''
| Section index for [[#Area Octree|area octree data]].
|-
|-
| 0x60
| 0x60
| 4 &times; SC
| u32
| '''Section sizes'''
| ''Data Section Count''
| '''Data Section Sizes'''
| Array containing the size of each data section in the file. Every size is always a multiple of 32.
|-
|-
| colspan=3 {{unknown|End of header; pad to 32 bytes before first section begins}}
| colspan=5 {{unknown|End of header; pad to 32 bytes before first data section begins}}
|}
|}


Line 85: Line 115:
|-
|-
| {{none}}
| {{none}}
| [[#Geometry|Geometry]]
| [[#World Geometry|World Geometry]]
|-
|-
| <code>AROT</code>
| <code>AROT</code>
Line 97: Line 127:
|-
|-
| {{none}}
| {{none}}
| {{unknown|Unknown}}
| {{unknown|[[#Unknown Section|Unknown]]}}
|-
|-
| <code>0xBABEDEAD</code>
| <code>0xBABEDEAD</code>
Line 109: Line 139:
|}
|}


==== Geometry ====
==== World Geometry ====


''See [[Materials (Metroid Prime)]] and [[Geometry (Metroid Prime)]]''
''See [[Materials (Metroid Prime)]] and [[Geometry (Metroid Prime)]]''


MREA files have one material section, followed by a number of meshes, each of which has its own set of geometry sections. There's couple small differences you'll usually see on MREA meshes compared to CMDL ones:
MREA files have one material section, followed by a number of world models, each of which has its own set of geometry sections. There's couple small differences you'll usually see on world models compared to regular CMDL ones:


* Normals are ''always'' shorts, so vertex format 0 is never used.
* Normals are ''always'' shorts, so vertex format 0 is never used.
* Most MREA meshes use lightmaps, so normally the first UV coordinate on each vertex will read from the short UV array. This isn't always the case, though; you need to make sure you check the material so you know where to read from.
* Most world models use lightmaps, so normally the first UV coordinate on each vertex will read from the short UV array. This isn't always the case, though; you need to make sure you check the material so you know where to read from.
* Surfaces will usually have a bounding box in the extra data in the surface header. This bounding box is used for depth sorting.
* Surfaces will usually have a bounding box in the extra data in the surface header. This bounding box is used for depth sorting.
* Each mesh starts with an extra header section which is formatted like this:
* Each world model starts with an extra header section which is formatted like this:


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 4
| [[#Visor Flags]]
| 1
| '''Visor Flags'''
| '''Visor Flags'''
| 32-bit bitfield that sets parameters controlling how the mesh renders in different visors.
|-
|-
| 0x4
| 0x4
| 4 &times; 12
| float
| '''Transform matrix'''
| 12
| '''World Model Transform'''
| World model's transform from the area's local origin. The geometry data is pre-transformed, so this matrix can largely be ignored.
|-
|-
| 0x34
| 0x34
| 4 &times; 6
| float
| '''Axis-aligned bounding box'''
| 6
| '''World Model Bounding Box'''
| Pre-transformed axis-aligned bounding box for this model.
|-
|-
| 0x4C
| 0x4C
Anonymous user

Navigation menu