Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:NIF (NetImmerse and Gamebryo model)

From ReverseEngineering.wiki
Format
Magic Gamebryo File Format, Version x.x.x.x\n
Extensions .nif, .kf, .kfm, .bto, .btr
Endianness little (a flag exists for big endian)
On this wiki Facts · Code · Notes · Topics

Binary scene/model format of NetImmerse and Gamebryo, used for meshes in Morrowind, Oblivion, Fallout 3, Skyrim and Fallout 4: a text header line, a version number (plus user and Bethesda stream versions), a table of block types, then the blocks. The community description is niftools/nifxml (nif.xml).

Identification

The file starts with an ASCII line ending in 0x0A: NetImmerse File Format, Version 4.0.0.2 (up to 10.0.1.2) or Gamebryo File Format, Version 20.2.0.7 (10.1.0.0 and later). Source: niftools/nifxml nif.xml (struct Header, GPL-3.0 licensed repository).

Header fields

In order: header string line; (versions up to 3.1) three copyright lines; Version u32 (0x14020007 for 20.2.0.7); Endian Type byte (since 20.0.0.3); User Version u32 (since 10.0.1.8); Num Blocks u32; for Bethesda games a BS stream header (BS Version u32, author, process script for BS Version below 131, export script, max file path since 103); Num Block Types u16; block type names (sized strings); a u16 type index per block; since 20.2.0.5 a u32 byte size per block; since 20.1.0.1 a string table (count, max length, strings); Num Groups and group sizes. The blocks follow, then a footer. Block types are named as C++ classes (NiNode, NiTriShape, BSLightingShaderProperty...).

Which game: version, user version, BS version

From nif.xml <version> entries:

Game File version User version BS version
Morrowind 4.0.0.2
Oblivion 20.0.0.4 / 20.0.0.5 (earlier 10.x in some files) 10 or 11 11 (also 1-9 in early files)
Fallout 3, New Vegas 20.2.0.7 11 14-34
Skyrim LE 20.2.0.7 12 83
Skyrim SE 20.2.0.7 12 100
Fallout 4 20.2.0.7 12 130
Fallout 76 20.2.0.7 12 155

So for Bethesda files read the version line, the user version and BS Version: the same 20.2.0.7 covers Fallout 3 to Fallout 76 and only the BS Version tells the game.

Related files

Terrain LOD uses .bto (objects) and .btr (terrain) in the same family; animations are .kf with NiControllerSequence blocks. Archives: Format:Bethesda archive (BSA and BA2).

Tools and references

  • niftools/nifxml: machine-readable description of all block types by version (the basis of niflib, pyffi and NifSkope).
  • xEdit has its own NIF reader (Core/wbDataFormatNif.pas) for asset checking.

Code & repositories

  • https://github.com/niftools/nifxml @ 970a6238218a106daaeb89a61bcda0eeaf9d08c4 · license: GPL-3.0
    nif.xml: machine-readable description of NIF blocks by version, Bethesda BS versions
    Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2024-09-15