NIFF 1.0 Specification

3. Binary Format

3.13 MatList


2) Mat Area

u32 mat_tag
u32 this_mat_index
u32 mat_size
u32 mat_name_index
u32 mat_type
u32 mat_shade_type
u32 mat_color_type0
u32 mat_color_type1
u32 mat_alpha_type0
u32 mat_alpha_type1
float prim_red
float prim_green
float prim_blue
float prim_alpha
u32 user_flag0
u32 user_flag1
u32 user_flag2
u32 user_flag3
u32 user_flag4
u32 user_flag5
u32 user_flag6
u32 user_flag7
u32 local_light_index
u32 tex_num
u32 nintendo_extension_block_size
u32 user_extension_block_size
u32 tex_index(0)
...
u32 tex_index(tex_num - 1)
NintendoExtensionBlock
UserExtensionBlock

Mat Area Memory Map
u32 mat_tag Tag indicating Mat. Set the following flag. 
TAG_MAT 0x000a0100

u32 this_mat_index Index number of this Mat area. 
u32 mat_size Size of this Mat area. 
u32 mat_name_index Index number in NameList that describes Mat name. 
u32 mat_type

The flags available for specifying material types in Mat are mat_type, mat_shade_type, mat_color_type0, mat_color_type1, mat_alpha_type0, and mat_alpha_type1.

The mat_type flag specifies how the flags set for the material types are applied. The following two specification methods are currently defined.


MAT_TYPE_NIFF           0x00000000
MAT_TYPE_N64            0x01010101

When MAT_TYPE_NIFF has been specified, mat_color_type* and mat_alpha_type* define the material type according to the respective MAT_TYPE_NIFF specification methods. In this case, the color value and alpha value can use all of the colors which are specified in NIFF.

When MAT_TYPE_N64 has been specified, mat_color_type* and mat_alpha_type* define the material types according to the respective MAT_TYPE_N64 specification method. In this case, all of the color combiner settings on the Nintendo 64 can be performed. However, since color values and alhpa values that do not exist as formats in NIFF cannot be used, it is necessary to allot those values in advance to several user_flags when converting data from NIFF to N64.

u32 mat_shade_type This field primarily specifies the shading attributes of materials. The following flags are currently defined.

MAT_SHADE_LIGHT_OFF       0x00000000
MAT_SHADE_LIGHT_LOCAL     0x00000001
MAT_SHADE_LIGHT_GLOBAL    0x00000002
MAT_SHADE_FLAT            0x00000000
MAT_SHADE_SMOOTH          0x00000010
MAT_SHADE_USE_HILIGHT     0x00000100
MAT_SHADE_USE_REFLECT     0x00000200

The MAT_SHADE_LIGHT_* flag specifies the effect of light on materials. If MAT_SHADE_LIGHT_OFF is set, the lighting process specified is not performed. If MAT_SHADE_LIGHT_LOCAL is set, the Light in LightList that has the index specified by the local_light_index of this Mat area is used. If MAT_SHADE_LIGHT_GLOBAL is used, the Light that links to Scene is used.

MAT_SHADE_FLAT and MAT_SHADE_SMOOTH are flags that specify shading information of triangles. If MAT_SHADE_FLAT is set, triangles are drawn using the spefified material. If MAT_SHADE_SMOOTH is set, triangles are drawn using the specified material with color graduated between vertices.

MAT_SHADE_USE_HILIGHT specifies the use of highlight texture mapping. MAT_SHADE_USE_REFLECT specifies the use of reflection texture mapping.

The MAT_SHADE_LIGHT_* flag must always be specified and only one MAT_SHADE_LIGHT_* setting can be specified. Either MAT_SHADE_FLAT or MAT_SHADE_SMOOTH must always be specified. The use of MAT_SHADE_USE_HILIGHT and MAT_SHADE_USE_REFLECT is optional. Only one or the other may be specified.

u32 mat_color_type0 Sets color gradations of materials.
u32 mat_color_type1 Sets color gradations of materials. Used only when specifying a 2-cycle mode rendering type.
u32 mat_alpha_type0 Sets alpha gradations of materials.
u32 mat_alpha_type1 Sets alpha gradations of materials. Used only when specifying a 2-cycle mode rendering type.
float prim_red Red component of primitive color 

0 <= prim_red <= 1.0

float prim_green Green component of primitive color 

0 <= prim_green <= 1.0

float prim_blue Blue component of primitive color 

0 <= prim_blue <= 1.0

float prim_alpha Alpha component of primitive color 

0 <= prim_alpha <= 1.0

u32 usr_flag0 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 usr_flag1 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 usr_flag2 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 usr_flag3 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 usr_flag4 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 usr_flag5 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 usr_flag6 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 usr_flag7 32-bit user-defined flag. With the converter to be released by NCL, there may be cases where a user flag is allocated data in advance.
u32 local_light_index Specifies the index number in LightList of Light that is referred to when specifying MAT_SHADE_LIGHT_LOCAL. Applies only when MAT_SHADE_LIGHT_LOCAL is specified. In other cases, this data area exists but its contents are ignored.
u32 tex_num The number of textures to be used with Mat. Either 0, 1, or 2. 
u32 nintendo_extension_block_size Size of Nintendo extension block 
u32 user_extension_block_size Size of user extension block
u32 tex_index Index number in TexList of the texture used with Mat. 
NintendoExtensinoBlock Nintendo extension block
UserExtensionBlock User extension block

Note: Refer to Section 4.12, About Mat, for precautions.


PreviousNext

Copyright 1997-1999 NINTENDO Co., Ltd. All rights reserved.