NIFF to NVF Converter

NIFF2NVF Index


1. Introduction to niff2nvf
2. How to use niff2nvf
3. Explanation of converter options
4. Notes
(1) The conversion of NIFF1.0 data
(2) Set color combiner (TRI, TRI_ALPHA)
(3) Converting texture
(4) Textures that are larger than TMEM
(5) Converting Global Light
5. Presently unsupported items and limitations
6. Revision History

Reference
Compatibility of NIFF data and NVF data

1. Introduction to niff2nvf Converter

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


2. How to use niff2nvf

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


3. Explanation of converter options

For "val," write the value you want to set for the particular option.

-scale val ( default 20.0 )
Sets the scale at conversion time.

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.

-vtxcache val ( default 32 )
Changes the microcode's vertex cache.

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.

-vtxload val ( default 32 )
Specifies the number of vertices that can be transferred at once with gsSPVertex.

-vtxseg val ( default 5 )
Specifies the segment number for the vertex buffer used by Triangle.

-envgseg val ( default 5 )
Specifies the segment number for the vertex buffer used by Envelope, Cluster.

-imgseg val ( default 6 )
Specifies the Texture Image segment number.

-tlutseg val ( default 7 )
Specifies the Texture LUT segment number.

-noreduct
Stops the Color Reduction process.

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.

-fog_off
FOG is not output.

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.

-mark_off
NVF's MRKR Chunk is not output.

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.

-shift_tile
Set SL and TL of Texture tile to 0.5 (Except when NIFF2_TEX_FILTER_POINT is specified

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.

-flot_off
By default, two FLOT Chunks are output: a FLOT for animation time management and a FLOT for Function management. This option stops these FLOT Chunks from being output.

-frate_30, -frate_org
By default, animation data of 30fps has double key values to be 60 fps considering previewing by 60 fps.

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.

-use_obj_group
Specifies use of the NIFF obj node's obj_group as the NVF group.

"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.

-?, -h, -help
Outputs a simple description of niff2nvf along with the version information.


4. Notes

(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.

(2) Set color combiner (TRI, TRI_ALPHA)

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