Materials (Metroid Prime): Difference between revisions
→Flags
>Aruki (→Flags) |
>Aruki (→Flags) |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The format for '''materials''' is seen in both the [[CMDL (Metroid Prime)|CMDL]] and [[MREA (File Format)|MREA]] formats and is identical in both. This particular material format appears in both Metroid Prime and Metroid Prime 2 with minor differences. | The format for '''materials''' is seen in both the [[CMDL (Metroid Prime)|CMDL]] and [[MREA (File Format)|MREA]] formats and is identical in both. This particular material format appears in both Metroid Prime and Metroid Prime 2 with minor differences. | ||
{{research|minor| | {{research|minor|MP1's materials are completely understood, but MP2 introduced two new values that are both unknown.}} | ||
__TOC__ | __TOC__ | ||
Line 76: | Line 76: | ||
| long | | long | ||
| 1 | | 1 | ||
| '''Group index''' | |||
|- | |- | ||
| long | | long | ||
Line 113: | Line 113: | ||
==== Flags ==== | ==== Flags ==== | ||
These are the known flag settings: | These are simple boolean settings that can be toggled on and off on each material. These are the known flag settings: | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 119: | Line 119: | ||
! Hex | ! Hex | ||
! Description | ! Description | ||
|- | |- | ||
| 0 | | 0 | ||
| 0x1 | | 0x1 | ||
| Unused, always set | | Unused, always set ''(never set in Echoes)'' | ||
|- | |- | ||
| 1 | | 1 | ||
| 0x2 | | 0x2 | ||
| Unused, always set | | Unused, always set | ||
|- | |- | ||
| 2 | | 2 | ||
| 0x4 | | 0x4 | ||
| Unused, | | Unused, never set | ||
|- | |- | ||
| 3 | | 3 | ||
| 0x8 | | 0x8 | ||
| | | Has Konst values | ||
|- | |- | ||
| 4 | | 4 | ||
| 0x10 | | 0x10 | ||
| | | Transparent | ||
|- | |- | ||
| 5 | | 5 | ||
| 0x20 | | 0x20 | ||
| | | Masked alpha (compare threshold is hardcoded at 0.25) | ||
|- | |- | ||
| 6 | | 6 | ||
| 0x40 | | 0x40 | ||
| Enable Samus's reflection | | Enable Samus's reflection | ||
|- | |- | ||
| 7 | | 7 | ||
| 0x80 | | 0x80 | ||
| Enable | | Enable Z-writes | ||
|- | |- | ||
| 8 | | 8 | ||
| 0x100 | | 0x100 | ||
| Enable Samus's reflection, using the eye position and direction from the surface header | | Enable Samus's reflection, using the eye position and projection direction from the surface header | ||
|- | |- | ||
| 9 | | 9 | ||
| 0x200 | | 0x200 | ||
| Shadow occluder mesh; meshes using this material are not rendered, but can be used to cast dynamic shadows on actors | | Shadow occluder mesh; meshes using this material are not rendered, but can be used to cast dynamic shadows on actors | ||
|- | |- | ||
| 10 | | 10 | ||
| 0x400 | | 0x400 | ||
| Enable indirect texture stage for reflections | | Enable indirect texture stage for reflections | ||
|- | |- | ||
| 11 | | 11 | ||
| 0x800 | | 0x800 | ||
| | | Indicates a lightmap is present; no ingame effect | ||
|- | |- | ||
| 12 | | 12 | ||
| 0x1000 | | 0x1000 | ||
| Unused, always set | | Unused, always set ''(never set in Echoes)'' | ||
|- | |- | ||
| 13 | | 13 | ||
| 0x2000 | | 0x2000 | ||
| Enable | | Enable first UV coordinate to use short array instead of float array (used for world lightmaps) | ||
|- | |- | ||
| 14 | | 14 | ||
| 0x4000 | | 0x4000 | ||
| | | {{unknown|In MP1, unused, never set; in Echoes, unknown}} | ||
|- | |- | ||
| 15 | | 15 | ||
| 0x8000 | | 0x8000 | ||
| | | {{unknown|In MP1, unused, never set; in Echoes, unknown}} | ||
|- | |- | ||
| 16-31 | | 16-31 | ||
| 0xFFFF0000 | | 0xFFFF0000 | ||
| TEV texture flags; a bit set indicates that the corresponding TEV stage uses a texture. | | TEV texture flags; a bit set indicates that the corresponding TEV stage uses a texture. No ingame effect. | ||
|} | |} | ||
==== Vertex Attribute Flags ==== | ==== Vertex Attribute Flags ==== | ||
These flags are generally toggled in pairs, with each pair corresponding to a vertex attribute; if a pair is set, then vertices using this material will have the corresponding attribute. This is vital for reading geometry. Starting in Echoes, each pair is used to indicate the size of the attribute indices in the geometry data, with 3 meaning a 16-bit index and 2 meaning an 8-bit index. | These flags are generally toggled in pairs, with each pair corresponding to a vertex attribute; if a pair is set, then vertices using this material will have the corresponding attribute. This is vital for reading geometry. Starting in Echoes, each pair is used to indicate the size of the attribute indices in the geometry data, with 3 meaning a 16-bit index and 2 meaning an 8-bit index. (This isn't actually used, though; the original game data always uses 16-bit indices.) | ||
GX supports up to 8 texture coords per vertex, but the game doesn't seem to allow you to assign more than 7 (though this could do with some double-checking). | GX supports up to 8 texture coords per vertex, but the game doesn't seem to allow you to assign more than 7 (though this could do with some double-checking). | ||
Line 283: | Line 265: | ||
| Tex6 Matrix Index | | Tex6 Matrix Index | ||
|} | |} | ||
==== Group Index ==== | |||
The group index marks groups of materials that all have the same settings, but different textures. The game will check the value after loading the textures (but prior to the vertex attribute flags), and check whether the group index set on the material matches the material currently set up. If it does, it will skip the rest of the material setup. The value typically starts at 0 on the first material and increments by 1 on each new group with different settings. | |||
==== Konst Colors ==== | ==== Konst Colors ==== | ||
Line 657: | Line 643: | ||
=== UV Animations === | === UV Animations === | ||
'' See [[UV Animations]]'' | |||
The UV animations section immediately follows the texgen flags. Its purpose is to generate texture matrices and post-transform matrices, which are then used to transform UV coordinates. This is commonly used to animate textures via simple UV scrolls, but it's also often used to simulate reflective surfaces that move with the camera. Materials can have multiple UV animations; in that case, each animation generates a separate texture/post-transform matrix and are loaded into GX sequentially. Texgen is used to set which matrices are used by which UV coordinates (if any). | The UV animations section immediately follows the texgen flags. Its purpose is to generate texture matrices and post-transform matrices, which are then used to transform UV coordinates. This is commonly used to animate textures via simple UV scrolls, but it's also often used to simulate reflective surfaces that move with the camera. Materials can have multiple UV animations; in that case, each animation generates a separate texture/post-transform matrix and are loaded into GX sequentially. Texgen is used to set which matrices are used by which UV coordinates (if any). | ||
Line 676: | Line 664: | ||
|} | |} | ||
For info on how to read the animation data and how each animation mode works, see [[UV Animations]]. | |||
For | |||
[[Category:File Formats]] | [[Category:File Formats]] | ||
[[Category:Metroid Prime]] | [[Category:Metroid Prime]] | ||
[[Category:Metroid Prime 2: Echoes]] | [[Category:Metroid Prime 2: Echoes]] |