## niff2nvf: NIFF to NVF Converter

### Index

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

Reference: Compatibility of NIFF 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 NIFF 1.0.

--- Main functions added with niff2nvf & NVF ---

( NIFF 2.0 data )

- Envelope
- IK
- Animation expansion (Constraint, Hermite interpolation)
- CI texture
- MIP map
- Settings for FOG
- PrimitiveColor Animation

( NIFF 1.0 data )

- Texture animation
- LOD
- Specular highlight

### 2.0 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.

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

-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 NIFF 1.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.

- Material

  |  |  | Red | Green | Blue | Alpha |
  Ambient Color | = | ( | 0xff, | 0xff, | 0xff, | 0xff | )
  Emission Color | = | ( | 0x00, | 0x00, | 0x00, | 0x00 | )
  Diffuse Color | = | ( | 0xff, | 0xff, | 0xff, | 0xff | )

- FOG settings (Assuming the NIFF1.0 data is 1 cycle)

  Cycle Type for fog | : | 2 cycle
  Render Mode for fog | : | < cycle1 > Specifies G_RM_FOG_SHADE_A
  | : | < cycle2 > Uses the NIFF 1.0 data's Render Mode
  CC Mode for fog | : | < cycle1 > Uses the NIFF 1.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 NIFF 1.0 data's PrimColor

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

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

Currently, texture animation is not compatible with the CI format (palettes cannot be switched).

Two textures can be used at the same time for the NIFF material mode, but the second texture cannot currently be converted.

#### (3) Texture Format

The following texture formats are currently compatible:

- RGBA (32bit, 16bit)
- CI (8bit, 4bit)
- IA (16bit, 8bit, 4bit)
- I (8bit, 4bit)

Note: The RGB format is converted as RGBA and is not compatible with the YUV format.

Copyright 1998-1999 NINTENDO Co.,Ltd./1998-1999 MONEGI CORPORATION All rights reserved.