Materials (Metroid Prime): Difference between revisions
Jump to navigation
Jump to search
no edit summary
>Aruki m (→GX Explanation) |
>Aruki No edit summary |
||
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| | {{research|minor|There are a couple unknown values left. Also, basically everything that was introduced in Echoes (two general settings and a vertex attribute) is unknown.}} | ||
__TOC__ | __TOC__ | ||
Line 661: | Line 661: | ||
0.0, 0.0, 0.0, 1.0</pre> | 0.0, 0.0, 0.0, 1.0</pre> | ||
==== Mode 7: | ==== Mode 7: Mode-Who-Must-Not-Be-Named ==== | ||
Mode 7 | Mode 7 takes two parameters and generates both a texture matrix and a post-transform matrix. | ||
The texture matrix is generated the same way as in mode 0; translation is ignored. | |||
<pre>texmtx = inverse(ViewMatrix) * ModelMatrix; | |||
texmtx[0][3] = texmtx[1][3] = texmtx[2][3] = 0;</pre> | |||
The post-transform matrix is where it gets a little complicated. A little math is required to calculate some values: | |||
<pre>float xy = ((ViewMatrix[0][3] + ViewMatrix[1][3]) * 0.025f * ParamB; | |||
xy = (xy - (int) xy); // This truncates the integer portion of the value, leaving only the fractional part (mantissa). | |||
float z = ViewMatrix[2][3] * 0.05f * ParamB; | |||
z = (z - (int) z); | |||
float halfA = ParamA * 0.5f;</pre> | |||
The post-transform matrix is then constructed as: | |||
<pre>halfA, 0.0f, 0.0f, xy, | |||
0.0f, 0.0f, halfA, z, | |||
0.0f, 0.0f, 0.0f, 1.0f</pre> | |||
[[Category:File Formats]] | [[Category:File Formats]] | ||
[[Category:Metroid Prime]] | [[Category:Metroid Prime]] | ||
[[Category:Metroid Prime 2: Echoes]] | [[Category:Metroid Prime 2: Echoes]] |