<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.metroid2002.com/retromodding/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sdmr</id>
		<title>Retro Modding Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.metroid2002.com/retromodding/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sdmr"/>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/wiki/Special:Contributions/Sdmr"/>
		<updated>2026-05-02T20:33:05Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=Materials_(Metroid_Prime)&amp;diff=601</id>
		<title>Materials (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=Materials_(Metroid_Prime)&amp;diff=601"/>
				<updated>2015-01-30T13:42:46Z</updated>
		
		<summary type="html">&lt;p&gt;Sdmr: grammar correction and minor improvements in readability&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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.&lt;br /&gt;
&lt;br /&gt;
{{research|moderate|There are a few unknown values, and some unknown settings in known values; there are also a few unknown material animation modes. Also, basically everything that was introduced in Echoes (two general settings and a vertex attribute) is unknown.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== GX Explanation ==&lt;br /&gt;
&lt;br /&gt;
The materials system in Metroid Prime is heavily dependent on the GameCube and Wii's graphics system, GX. GX is a fixed-function graphics pipeline, similar to old versions of OpenGL. In GX, rendering is done through a series of steps called '''T'''exture '''E'''n'''V'''ironment Stages, or or TEV stages for short.&lt;br /&gt;
&lt;br /&gt;
Prior to TEV stages, per-vertex calculations are performed. Lighting calculations are performed and passed to GX as a rasterized vertex color; texture coordinate generation (texgen) is also performed and made available to TEV.&lt;br /&gt;
&lt;br /&gt;
How TEV stages actually work: Each TEV stage takes in four color (RGB) inputs and four alpha inputs, from one of eight sources. Then these four input colors are combined into one output color, and the output is saved into one of four registers, which can subsequently be used as input in the next TEV stages. The final stage must always save its output into the &amp;quot;previous TEV stage&amp;quot; register; that register is used as the final pixel color that gets displayed onscreen.&lt;br /&gt;
&lt;br /&gt;
== Material Set Format ==&lt;br /&gt;
&lt;br /&gt;
Materials come as part of a set; often there will only be one set per file, but many CMDLs can have more than one. The set begins with a short header before the actual material data begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type&lt;br /&gt;
!Count&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texture file IDs'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Material count''' (MC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| MC&lt;br /&gt;
| '''Material end offsets''' (relative to the start of the first material)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=3 | Materials begin&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Material Format ==&lt;br /&gt;
&lt;br /&gt;
=== General Settings ===&lt;br /&gt;
&lt;br /&gt;
Each material begins with a flags value, followed by a list of texture indices:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type&lt;br /&gt;
!Count&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texture indices''' (these are indices into the material set texture array)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Vertex attribute flags'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown''' ''(note: only in Echoes)''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown''' ''(note: only in Echoes)''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst count''' (KC); max setting is 4. ''(note: only present if flag 0x8 is set!)''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| KC&lt;br /&gt;
| '''Konst colors''' - 32-bit RGBA colors ''(note: not present if the Konst count isn't)''&lt;br /&gt;
|-&lt;br /&gt;
| short&lt;br /&gt;
| 1&lt;br /&gt;
| '''Blend destination factor'''&lt;br /&gt;
|-&lt;br /&gt;
| short&lt;br /&gt;
| 1&lt;br /&gt;
| '''Blend source factor'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| {{unknown|'''Unknown''' ''(note: only present if flag 0x400 is set!)''}}&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Color channel flag count''' (CC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| CC&lt;br /&gt;
| '''Color channel flags'''&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''TEV stage count'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Flags ====&lt;br /&gt;
&lt;br /&gt;
These are the known flag settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 0x1&lt;br /&gt;
| Appears unused, but always set&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 0x2&lt;br /&gt;
| Appears unused, but always set&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 0x4&lt;br /&gt;
| Appears unused, but always unset&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| 0x8&lt;br /&gt;
| Enable Konstant values&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 0x10&lt;br /&gt;
| Mark transparent material&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 0x20&lt;br /&gt;
| Enable punchthrough alpha&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| 0x40&lt;br /&gt;
| Enable Samus's reflection&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| 0x80&lt;br /&gt;
| Enable depth writing&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 0x100&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| 0x200&lt;br /&gt;
| Don't draw&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 0x400&lt;br /&gt;
| Enable second unknown value&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 0x800&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 0x1000&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| 0x2000&lt;br /&gt;
| Enable lightmaps; first UV coordinate uses short array instead of float array&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| 0x4000&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| 0x8000&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 0x10000&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| 0x20000&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 18&lt;br /&gt;
| 0x40000&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 19&lt;br /&gt;
| 0x80000&lt;br /&gt;
| {{unknown|Unknown}}&lt;br /&gt;
|-&lt;br /&gt;
| 20+&lt;br /&gt;
| 0x100000+&lt;br /&gt;
| Unused; never set&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Vertex Attribute Flags ====&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
An important note is that while the leftmost byte is not used in Prime 1, in Echoes there's occasionally a value there that toggles an extra vertex attribute preceding position. This needs research to determine what the new attribute actually is. Also, 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).&lt;br /&gt;
&lt;br /&gt;
These are the possible attributes:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit pair&lt;br /&gt;
! Attribute&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| Position&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| Normal&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| Color 0&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| Color 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x300&lt;br /&gt;
| Tex 0&lt;br /&gt;
|-&lt;br /&gt;
| 0xC00&lt;br /&gt;
| Tex 1&lt;br /&gt;
|-&lt;br /&gt;
| 0x3000&lt;br /&gt;
| Tex 2&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0000&lt;br /&gt;
| Tex 3&lt;br /&gt;
|-&lt;br /&gt;
| 0x300000&lt;br /&gt;
| Tex 4&lt;br /&gt;
|-&lt;br /&gt;
| 0xC00000&lt;br /&gt;
| Tex 5&lt;br /&gt;
|-&lt;br /&gt;
| 0x3000000&lt;br /&gt;
| Tex 6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Konst Colors ====&lt;br /&gt;
&lt;br /&gt;
These values are only present when flag 0x8 is enabled. These allow you to set Konstant values, which can subsequently be used as inputs in TEV stages. The maximum number of Konst values you can set on one material is 4. The colors themselves are simply 32-bit RGBA values.&lt;br /&gt;
&lt;br /&gt;
==== Blend Mode ====&lt;br /&gt;
&lt;br /&gt;
The two blend factors set the blending mode used. The most common values you'll see are 0/1, which is used on opaque materials; transparent materials will usually have either 1/1, for additive blending, or 5/4, for alpha blending. Here's the full range of possible settings for each value:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Blend factor&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| GX_BL_ZERO&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| GX_BL_ONE&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| GX_BL_SRCCLR / GX_BL_DSTCLR&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| GX_BL_INVSRCCLR / GX_BL_INVSRCCLR&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| GX_BL_SRCALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| GX_BL_INVSRCALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| GX_BL_DSTALPHA&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| GX_BL_INVDSTALPHA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Channels ====&lt;br /&gt;
&lt;br /&gt;
There's an odd quirk with how these values work; although there's a count value listed, the game will only actually read the first value listed and then skip the rest. There's no reason to ever have more than one flag value. Aside from that, how this works is unknown and needs research.&lt;br /&gt;
&lt;br /&gt;
=== TEV Stages ===&lt;br /&gt;
&lt;br /&gt;
There'll be one of these structures per TEV stage:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Color Input Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Alpha Input Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''Color Combine Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Alpha Combine Flags'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 1&lt;br /&gt;
| '''Padding'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x11&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst Alpha Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x12&lt;br /&gt;
| 1&lt;br /&gt;
| '''Konst Color Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x13&lt;br /&gt;
| 1&lt;br /&gt;
| '''Rasterized Color Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| colspan=2 {{unknown|End of TEV stage}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
After looping through each TEV stage, there will be one of these structures per stage:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 2&lt;br /&gt;
| '''Padding'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texture TEV Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 1&lt;br /&gt;
| '''Tex Coord TEV Input'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| colspan=2 {{unknown|End of structure}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Input Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags set the four color inputs that are used by the TEV stage. Each color is allocated 5 bits, even though only 4 are actually used; the lower bits correspond to the lower input numbers (eg. the bottom 5 bits refer to the first input).&lt;br /&gt;
&lt;br /&gt;
There are 16 possible color sources:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Binary&lt;br /&gt;
! Hex&lt;br /&gt;
! Color Source&lt;br /&gt;
|-&lt;br /&gt;
| 00000&lt;br /&gt;
| 0x0&lt;br /&gt;
| Previous stage RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00001&lt;br /&gt;
| 0x1&lt;br /&gt;
| Previous stage AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00010&lt;br /&gt;
| 0x2&lt;br /&gt;
| Color 0 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00011&lt;br /&gt;
| 0x3&lt;br /&gt;
| Color 0 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Color 1 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00101&lt;br /&gt;
| 0x5&lt;br /&gt;
| Color 1 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 00110&lt;br /&gt;
| 0x6&lt;br /&gt;
| Color 2 RGB&lt;br /&gt;
|-&lt;br /&gt;
| 00111&lt;br /&gt;
| 0x7&lt;br /&gt;
| Color 2 AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01000&lt;br /&gt;
| 0x8&lt;br /&gt;
| Texture RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01001&lt;br /&gt;
| 0x9&lt;br /&gt;
| Texture AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01010&lt;br /&gt;
| 0xA&lt;br /&gt;
| Rasterized RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01011&lt;br /&gt;
| 0xB&lt;br /&gt;
| Rasterized AAA&lt;br /&gt;
|-&lt;br /&gt;
| 01100&lt;br /&gt;
| 0xC&lt;br /&gt;
| One&lt;br /&gt;
|-&lt;br /&gt;
| 01101&lt;br /&gt;
| 0xD&lt;br /&gt;
| Half&lt;br /&gt;
|-&lt;br /&gt;
| 01110&lt;br /&gt;
| 0xE&lt;br /&gt;
| Konstant RGB&lt;br /&gt;
|-&lt;br /&gt;
| 01111&lt;br /&gt;
| 0xF&lt;br /&gt;
| Zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Alpha Input Flags ====&lt;br /&gt;
&lt;br /&gt;
Similar to the color input flags, these set the four alpha inputs used by the TEV stage. Each value is allocated 5 bits, although only 3 are used. The main difference with alpha is that there are only 8 possible sources instead of 16:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Binary&lt;br /&gt;
! Hex&lt;br /&gt;
! Alpha Source&lt;br /&gt;
|-&lt;br /&gt;
| 00000&lt;br /&gt;
| 0x0&lt;br /&gt;
| Previous stage alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00001&lt;br /&gt;
| 0x1&lt;br /&gt;
| Color 0 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00010&lt;br /&gt;
| 0x2&lt;br /&gt;
| Color 1 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00011&lt;br /&gt;
| 0x3&lt;br /&gt;
| Color 2 alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Texture alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00101&lt;br /&gt;
| 0x5&lt;br /&gt;
| Rasterized alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00110&lt;br /&gt;
| 0x6&lt;br /&gt;
| Konstant alpha&lt;br /&gt;
|-&lt;br /&gt;
| 00111&lt;br /&gt;
| 0x7&lt;br /&gt;
| Zero&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Color Combine Flags ====&lt;br /&gt;
&lt;br /&gt;
These flags specify how the operation that combines the four input colors into one output color is performed.&lt;br /&gt;
&lt;br /&gt;
This is the combiner function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;tevrigid = (d (tevop) ((1.0-c)*a + c*b) + tevbias) * tevscale;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The values set in the color operation flags correspond to the parameters passed to [http://libogc.devkitpro.org/gx_8h.html#a067b875ff1e3e6760d0d7d7838c6c4c2 GX_SetTevColorOp()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-3&lt;br /&gt;
| 0xF&lt;br /&gt;
| '''Combiner operator''' ([http://libogc.devkitpro.org/group__tevop.html tevop])&lt;br /&gt;
|-&lt;br /&gt;
| 4-5&lt;br /&gt;
| 0x30&lt;br /&gt;
| '''Bias''' ([http://libogc.devkitpro.org/group__tevbias.html tevbias]); 00 does nothing; 01 adds 0.5; 10 subtracts 0.5; 11 does nothing.&lt;br /&gt;
|-&lt;br /&gt;
| 6-7&lt;br /&gt;
| 0xC0&lt;br /&gt;
| '''Scale''' ([http://libogc.devkitpro.org/group__tevscale.html tevscale]); 00 does nothing; 01 multiples by 2; 10 multiplies by 4; 11 divides by 2.&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 0x100&lt;br /&gt;
| '''Clamp flag'''; enabling this will clamp the output color between 0 and 1.&lt;br /&gt;
|-&lt;br /&gt;
| 9-10&lt;br /&gt;
| 0x600&lt;br /&gt;
| '''Output register''' ([http://libogc.devkitpro.org/group__tevcoloutreg.html tevrigid]); can be Previous Stage or Color 0/1/2&lt;br /&gt;
|-&lt;br /&gt;
| 11+&lt;br /&gt;
| 0xFFFFF800&lt;br /&gt;
| Unused.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that the vast majority of materials in the game, if not all of them, don't really bother with any of this; they enable clamping, set an output register, and leave everything else at their defaults of 0.&lt;br /&gt;
&lt;br /&gt;
==== Alpha Combine Flags ====&lt;br /&gt;
&lt;br /&gt;
This is exactly the same as the color combine flags; the only difference is it operates on alpha instead of color.&lt;br /&gt;
&lt;br /&gt;
=== Texgen ===&lt;br /&gt;
&lt;br /&gt;
After the TEV stages comes a sequence of flags determining how texgen is executed. Texgen is the process of taking input values and using them to generate texture coordinates (or UV coordinates), which can then be used by the TEV stages. It's important to note that any vertex attribute can be used as a texgen input; in fact, it's rather common for materials to use the vertex normal as an input to simulate reflections. That means ''the number of texture coords present on each vertex is not the same as the number of texture coords available to TEV''.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type&lt;br /&gt;
! Count&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| 1&lt;br /&gt;
| '''Texgen count''' (TC)&lt;br /&gt;
|-&lt;br /&gt;
| long&lt;br /&gt;
| TC&lt;br /&gt;
| '''Texgen flags'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The flags correspond to arguments passed to [http://libogc.devkitpro.org/gx_8h.html#a55a426a3ff796db584302bddd829f002 GX_SetTexCoordGen2()]. These are the settings:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bits&lt;br /&gt;
! Hex&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0-3&lt;br /&gt;
| 0xF&lt;br /&gt;
| '''Texture coord generation type''' ([http://libogc.devkitpro.org/group__texgentyp.html tgen_typ])&lt;br /&gt;
|-&lt;br /&gt;
| 4-8&lt;br /&gt;
| 0x1F0&lt;br /&gt;
| '''Texture coord source''' ([http://libogc.devkitpro.org/group__texgensrc.html tgen_src])&lt;br /&gt;
|-&lt;br /&gt;
| 9-13&lt;br /&gt;
| 0x3E00&lt;br /&gt;
| '''Texture matrix index''' ([http://libogc.devkitpro.org/group__texmtx.html mtxsrc] - add 30)&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| 0x4000&lt;br /&gt;
| '''Normalize flag''' - normalizes texture coord after it's multiplied by the texture matrix (normalize)&lt;br /&gt;
|-&lt;br /&gt;
| 15-20&lt;br /&gt;
| 0x1F8000&lt;br /&gt;
| '''Post-transform texture matrix index''' ([http://libogc.devkitpro.org/group__dttmtx.html postmtx] - add 64)&lt;br /&gt;
|-&lt;br /&gt;
| 21+&lt;br /&gt;
| 0xFFE00000&lt;br /&gt;
| Unused&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Material Animations ===&lt;br /&gt;
&lt;br /&gt;
The material animations section immediately follows the texgen flags. It starts with this short header:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Material animations section size''' (includes animation count, so will be 4 at minimum)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Animation count'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The structure of the animations themselves is somewhat simple. Each animation has a 32-bit ''mode'' setting, followed by a number of float parameters. The number and usage of these float parameters varies depending on what mode is set. There are 7 possible modes, but only modes 2 through 5 are known.&lt;br /&gt;
&lt;br /&gt;
For all of the following modes, let ''s'' be equal to ''seconds mod 900''.&lt;br /&gt;
&lt;br /&gt;
==== Mode 2: UV Offset ====&lt;br /&gt;
&lt;br /&gt;
This mode is used to scroll both U and V at the same time. It has four float parameters: ''offsetA'', ''offsetB'', ''scaleA'', and ''scaleB''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;uOffset = (s * scaleA) + offsetA;&lt;br /&gt;
vOffset = (s * scaleB) + offsetB;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mode 3: Rotation ====&lt;br /&gt;
&lt;br /&gt;
This mode rotates the material. It has two float parameters: ''offset'' and ''scale''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;angle = (s * scale) + offset;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The material is then rotated by ''angle'' degrees.&lt;br /&gt;
&lt;br /&gt;
==== Mode 4/5: U/V Offset ====&lt;br /&gt;
&lt;br /&gt;
This mode can be used to scroll U and V independently from each other. It has four float parameters. The offset calculation for these modes is unknown; however, the same code is used for both modes, with the only difference being whether the calculated offset is applied to U or V.&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;/div&gt;</summary>
		<author><name>Sdmr</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=SCAN_(Metroid_Prime)&amp;diff=600</id>
		<title>SCAN (Metroid Prime)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=SCAN_(Metroid_Prime)&amp;diff=600"/>
				<updated>2015-01-30T13:32:49Z</updated>
		
		<summary type="html">&lt;p&gt;Sdmr: grammar correction and minor improvements in readability&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''.SCAN file format''' describes scannable objects and has references to several resources. It is a relatively simple format and has a static size.&lt;br /&gt;
&lt;br /&gt;
{{researchmoderate|reason=Too many unknowns.}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The SCAN format is very simple; it has a header with data that contains general settings related to the scan, and then four structs defining how the scan images work. Even if a scan doesn't use four images, there are always four image structs, which means that the SCAN format has a static size; every SCAN file is 0x89 bytes (or 0xA0 bytes padded).&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The header is rather simple, and consists of the following:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| '''Version'''; 3 for the demo, 5 for the final&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| '''Magic'''; always 0x0BADBEEF&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| '''[[FRME (File Format)|FRME]] ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| '''Scan text [[STRG (File Format)|STRG]] ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| '''Scan Speed Flag'''; 0 = normal fast scan, 1 = slower scan (usually found in boss fights)&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| '''Logbook Category'''; see below&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 1&lt;br /&gt;
| '''Scan Icon Flag'''; 0 = orange icon, 1 = red icon&lt;br /&gt;
|-&lt;br /&gt;
| 0x19&lt;br /&gt;
| colspan=2 {{unknown|End of header}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Logbook Category ====&lt;br /&gt;
&lt;br /&gt;
There are five possible values:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! ID&lt;br /&gt;
! Category&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Not a logbook scan&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Space Pirate Data&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Chozo Lore&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| Creatures&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| Research&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scan Images ===&lt;br /&gt;
[[File:Scan_positions1.png|thumb|300px|Offsets for the different scan images and their positions]]&lt;br /&gt;
[[File:Scan_positions2.png|thumb|300px]]&lt;br /&gt;
Following the header is an array of four structs that contain settings for up to four scan images. Although there can be anywhere from 0 to 4 scan images attached to a scan, there are always four scan image entries here. Entries that aren't used have their TXTR ID set to 0xFFFFFFFF, with the rest of the settings mostly left at defaults. They follow this format:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Type&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| '''[[TXTR (Metroid Prime)|TXTR]] ID'''&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 4&lt;br /&gt;
| float&lt;br /&gt;
| '''Appearance %'''; image will appear when the scan is this% complete. Should range from 0 to 1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| {{unknown|'''Unknown (Fade in duration?)'''}}&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 4&lt;br /&gt;
| long&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 4&lt;br /&gt;
| float&lt;br /&gt;
| {{unknown|'''Unknown'''}}&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| colspan=3 {{unknown|End of entry}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime]]&lt;/div&gt;</summary>
		<author><name>Sdmr</name></author>	</entry>

	<entry>
		<id>http://www.metroid2002.com/retromodding/index.php?title=SCAN_(Metroid_Prime_2)&amp;diff=599</id>
		<title>SCAN (Metroid Prime 2)</title>
		<link rel="alternate" type="text/html" href="http://www.metroid2002.com/retromodding/index.php?title=SCAN_(Metroid_Prime_2)&amp;diff=599"/>
				<updated>2015-01-30T13:29:34Z</updated>
		
		<summary type="html">&lt;p&gt;Sdmr: grammar correction and minor improvements in readability&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''.SCAN file format''' describes SCAN POI data and has references to several resources. This variation of the format is completely different than its [[SCAN (Metroid Prime)|Metroid Prime]] counterpart.&lt;br /&gt;
&lt;br /&gt;
{{researchmajor|reason=Crack SNFO}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Header=&lt;br /&gt;
The header is rather simple and consists of the following:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Offset&lt;br /&gt;
!Size&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|0x0&lt;br /&gt;
|4&lt;br /&gt;
|'''Magic''' FourCC&lt;br /&gt;
|-&lt;br /&gt;
|0x4&lt;br /&gt;
|4&lt;br /&gt;
|'''Version''' Always 2, no matter what game&lt;br /&gt;
|-&lt;br /&gt;
|0x8&lt;br /&gt;
|1&lt;br /&gt;
|{{unknown|Boolean?}}&lt;br /&gt;
|-&lt;br /&gt;
|0x9&lt;br /&gt;
|4&lt;br /&gt;
|{{unknown|Unknown}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=SNFO Chunk=&lt;br /&gt;
The SNFO header is simply a FourCC and the total length in bytes. Due to the fact that there is nothing in the header to determine which version of SCAN we're working with, we have to rely on the size of the SNFO chunk. If it's less than 0x0251 bytes, it's Metroid Prime 2. Otherwise it's Metroid Prime 3.&lt;br /&gt;
&lt;br /&gt;
Other than that, SNFO is entirely unknown.&lt;br /&gt;
&lt;br /&gt;
=Dependency List=&lt;br /&gt;
The dependency list follows the same format as [[DGRP (File Format)|DGRP]]&lt;br /&gt;
[[Category:File Formats]]&lt;br /&gt;
[[Category:Metroid Prime 2: Echoes]]&lt;br /&gt;
[[Category:Metroid Prime 3: Corruption]]&lt;br /&gt;
[[Category:Major research needed]]&lt;/div&gt;</summary>
		<author><name>Sdmr</name></author>	</entry>

	</feed>