Star Fox:Material Data

From Data Crystal
Revision as of 03:14, 27 May 2019 by SpyderTL (talk | contribs) (Added texture map tile information.)
Jump to: navigation, search

Material Data
Game Star Fox
Start Address 0x010000
End Address 0x017FFF
# of Entries unknown
Entry Length unknown
Total Length 32,768 bytes (0x8000)
Back to the ROM map


Offset  Size    Description
------- ----    -----------
 0x00   1       Material Value
 0x01   1       Material Type

Material Data

Each object has a "base" material address, and each face in the model for that object has a material offset. Each material entry is 2 bytes, has a material type and a material value. Materials can either be textured, shaded by distance and face direction, dynamically shaded, or statically colored. Statically colored materials actually contain two color palette values, and the surface is rendered using a checkerboard pattern, alternating between the two colors. Materials can also be animated by jumping to a separate material table that contains a list of standard materials to be rendered in sequence.

Distance Shaded

Distance shaded materials have a material type of 0x00 to 0x0A, and the material value always matches the material type. These 10 colors are shifted by the game engine based on both the direction of the face in relation to a light source, and the distance of the object from the camera.

Dynamically Shaded

Dynamically shaded materials have a material type of 0x3E, and can be altered by the game engine. For instance, when the player dies, the screen fades to a dark red shade by shifting all of the colors in the dynamic color lookup table at address 0x18B8A.

Statically Colored

Statically colored materials have a material type of 0x3F. The material value contains two colors -- the high 4-bits and the low 4-bits. These colors are rendered on the screen in an alternating checkerboard pattern for a dithering effect that allows more than the standard 16 colors to be displayed. The game engine chooses which palette (day, night, space) to use when rendering these colors to the screen.

Textured Materials

Material Type Texture Width Texture Height Effect
0x40 32 32 Flip Horizontal
0x41 64 64 Flip Horizontal
0x42 8 8 Flip Horizontal
0x43 64 16 Flip Horizontal
0x44 32 8 Flip Horizontal
0x45 32 8
0x46 64 64
0x47 16 8
0x48 32 32
0x49 64 64 Polar Mapped 45 Degrees
0x4a 64 64 Polar Mapped -45 Degrees

The method for finding the texture "tile" using the Material Value byte is currently unknown. The high bit of the Material Value byte seems to specify which texture map "page" to use. It is possible that there is another lookup table somewhere in ROM that maps the Material Value to the tile location.

Animated Materials

If the high bit of the material type is set, then this material is animated. The low byte of the material type is combined with the material value to find the 12-bit offset of the animated material in the animated material table, starting at address 0x18000.

Offset  Size    Description
------- ----    -----------
 0x00   1       Frame Count
 0x01   Count*2 Frames

Each frame in the animation has the same format as the normal materials in the material table (i.e. Material Type and Material Value).