Materials (Metroid Prime): Difference between revisions
Jump to navigation
Jump to search
→Color Channels
>Aruki |
>Aruki |
||
Line 324: | Line 324: | ||
|} | |} | ||
There's only one set of flags, which operates on COLOR0. COLOR1 | There's only one set of flags, which operates on COLOR0. COLOR1's settings can't be directly modified. Here's how the other color channel settings work. | ||
COLOR1A1's settings vary depend whether shadowmaps are enabled (they are enabled for the arm cannon and morph ball; otherwise they'll be disabled): | |||
* No processing will be done if the count value is 0. Otherwise, the count value is ignored; the game will always set up both color channels. | * No processing will be done if the count value is 0. Otherwise, the count value is ignored; the game will always set up both color channels. | ||
* COLOR1A1's ambient color is black, and its material color is white. | * COLOR1A1's ambient color is black, and its material color is white. | ||
* COLOR1 will use the diffuse function GX_DF_CLAMP and the attenuation function GX_AF_SPOT. It will have lighting disabled entirely if there are no lights in range | * COLOR1 will use the diffuse function GX_DF_CLAMP and the attenuation function GX_AF_SPOT. It will have lighting disabled entirely if there are no lights in range | ||
If shadowmaps are disabled: | If shadowmaps are disabled: | ||
* COLOR1 is disabled if the count value is not 2. If it is 2, then its ambient color will be black and its material color will be white. | * COLOR1 is disabled if the count value is not 2. If it is 2, then its ambient color will be black and its material color will be white. | ||
* COLOR0 | |||
COLOR0 is set up the same way either way: | |||
* COLOR0 will use the flags from the material, with the light mask merged in. It will also have lighting disabled if there are no lights in range. | |||
* If there are no lights in range, COLOR0A0 will have its material color set to match its ambient color. Otherwise, its material color will be set to white. | |||
Finally, an important note is that the formatting of the color channel info is bugged. There is always a color channel count and a single set of flags; 8 bytes total. However, for some reason the game is expecting one set of flags per color channel. To reach the TEV stages, you need to advance (4 * count) bytes past the count value, rather than 4. A likely explanation is that there was one set of flags per channel earlier in development, and the material loading code wasn't fully updated when this was changed. It's not normally an issue because the count is always 1 in every file the game uses, but beware for experimentation/custom materials. | Finally, an important note is that the formatting of the color channel info is bugged. There is always a color channel count and a single set of flags; 8 bytes total. However, for some reason the game is expecting one set of flags per color channel. To reach the TEV stages, you need to advance (4 * count) bytes past the count value, rather than 4. A likely explanation is that there was one set of flags per channel earlier in development, and the material loading code wasn't fully updated when this was changed. It's not normally an issue because the count is always 1 in every file the game uses, but beware for experimentation/custom materials. |