NIFF2NVF Index
niff2nvf is the converter used to change NIFF formated data into NVF formated data. It supports both NIFF version 1.0 and version 2.0 (henceforth NIFF 1.0 and NIFF 2.0). However, when NIFF-formatted data created with NIFF 1.0 is converted to NVF format, some data is lost, such as material settings. Accordingly, niff2nvf outputs supplemental data for this.
The NVF format was created to make the utmost use of the NIFF 2.0 functions, so numerous functions were added, as shown below. But because of this, the nd structure is in binary format, which is significantly different from the C source file format used with NIFF1.0.
Main functions added with niff2nvf & NVF
NIFF 2.0 data
NIFF 1.0 data
To use niff2nvf, make an entry using the following syntax on the command line.
niff2nvf [options] < input_niff_file > < output_nvf_file >
For example, to set the scale at 5.0 and convert the file input.niff into the file output.nvf, you would input the following line.
niff2nvf -scale 5.0 input.niff output.nvf
For "val," write the value you want to set for the particular option.
In N64, the vertex values are described as signed 16 bit integers in the Vtx table. The numerics that make up the original model data are rounded off, so the original shape is sometimes destroyed. If this happens, specify this option. The default setting is 20x scale.
In gspF3DEX, the vertex cache is 32, but this can be increased to 64 for gspF3DLX.Rej and to 80 for gspF3DLP. If you are going to use these microcodes, then increase the vertex cache with this option for conversion. The default is 32.
If you are using colors attached to palettes and you exceed the number of palettes for which bit map color is specified, then similar colors will be selected by default by the color reduction process. You can stop this process by using this option. However, if there are more bit map colors than palettes, then a message will be output and the conversion will stop. Thus, if you are going to use this option, confirm that you have reduced colors as much as possible for textures on your own.
If your data includes a FOG node, the FOG settings will be used. If those settings have not been set appropriately, you will not be able to preview images as expected. When the FOG settings are not correct and you cannot preview, use this option to eliminate the FOG so previewing becomes possible.
MRKR Chunk is output in order to preview the Effector's ICON. This is not needed for game-use model data, so you can use this option when you want to remove an unnecessary MRKR Chunk.
Texture tile is shifted by 0.5 for filtering. By setting SL and TL to 0.5, you can eliminate this effect by a 0.5 shift. This is efficient, for example when using MIPMAP.
The -frate_30 option makes half key values of 60 fps, (to 30 fps) in order to be previewed by 30 fps.
The -frate_org option uses the output data as it is without regard to frame rate.
"group" is used in NVF to control the rendering order, and it has various important roles, such as toggling CAMERA drawing ON/OFF. With NIFF data, the order for drawing is specified by the 7-step rendering priority of obj_render_pri. By default, these 7 steps are set as 0-6 in group. (So an opaque OBJECT is rendered first, for example.)
With NVF, group can support 32 steps (0-31) for finer settings. If you want to set group with detailed specifications, then raise this flag and you can directly specify the NVF group with the NIFF data obj_group.
(1) The conversion of NIFF1.0 data
NVF data is designed to function with NIFF 2.0, so when NIFF 1.0 data is converted some data is lacking. Because of this, niff2nvf converts the following default values to supplement the data.
Red | Green | Blue | Alpha | ||||||||||||
Ambient Color | = | ( | 0xff, | 0xff, | 0xff, | 0xff | ) | ||||||||
Emission Color | = | ( | 0x00, | 0x00, | 0x00, | 0x00 | )
Diffuse Color | = | ( | 0xff, | 0xff, | 0xff, | 0xff | )
| |
Cycle Type for fog | : | 2 cycle
Render Mode for fog | : | < cycle1 > Specifies G_RM_FOG_SHADE_A
| | : | < cycle2 > Uses NIFF1.0 data's Render Mode
| CC Mode for fog | : | < cycle1 > Uses the NIFF1.0 data's CC settings
| | | (However, SHADE_ALPHA is replaced by 1)
| | : | < cycle2 > [ 0, 0, 0, combined ]
| | | (cycle 1 results are used)
| PrimColor for fog | : | Uses the NIFF1.0 data's PrimColor
| |
When MAT_TYPE_NIFF is specified for mat_type, the MAT_CC_NIFF_TRI and MAT_CC_NIFF_TRI_ALPHA flags are present as a type_flag. This is for Triangle Color combining and has nothing to do with lighting, etc. In niff2gfx, Triangle Color is assigned to the Env register and ENV is specified in the color combiner settings. However, NVF does not support use of the Env register in this way, so please do not use MAT_CC_NIFF_TRI, and MAT_CC_NIFF_TRI_ALPHA. (If you do use this, 0xffffffff will be entered into the Env register, so the color will be white or opaque.)
(3) Converting textures
In order for NVF to load textures quickly, bank division and swapping processes are carried out on the combiner side, and NVF uses the bit map which has been converted to the format for TMEM. For this reason, please be careful when independently processing the NVF data bit maps.
Furthermore, although niff2nvf was made to support all NIFF texture formats, at the present time YUV format textures cannot be previewed correctly. When a YUV format texture is met, conversion stops as if the format is not supported.
(4) Textures that are larger than TMEM
With niff2gfx, when a texture is larger in size than TMEM, tiles are created from triangle units, and gDPLoadMultiTile is used to load part of the large texture. But NVF, in order to operate faster, loads the texture after it has been converted into the format for TMEM. Accordingly, textures that are larger in size than TMEM cannot be used as they are. To handle this, the niff2nvf converter divides the texture into triangle units and then converts them. Take care at this time, since the location of the triangles can make for inefficient texture division. (However, in version1.04 or later, the transaltion to marge tiles created in the triangle unit and decrease the devision of number textures added.)
(5) Converting Global Light
Sometimes when NIFF data is created with the CG tool the light is output with 0 Color. When an OBJECT is rendered using light with zero color, the image will be completely black and you will not see anything. For this reason, niff2nvf will not convert GlobalLight into NVF data format if GlobalLight is comprised solely of Ambient Light with 0 Color. In these cases, the previewer's default light is used.
5. Presently unsupported items and limitations
(1) External references
At the present time, there is no support for any external references inside the NIFF data.
(2) Texture
Two textures can be linked at the same time for the NIFF material mode, but the second texture is not currently converted.
(3) Texture Format
The following texture formats are currently compatible:
The RGB format is converted as RGBA and is not compatible with the YUV format