NiLODNode

From GECK
Jump to: navigation, search

NiLODNodes are a method of creating per-NIF level of detail geometry unconnected to cell LOD generated by either GECK or LODGen. They enable you to set up multiple blocks of variable detail, each with a configurable minimum and maximum render range. Think of it as mipmaps, but with sets of meshes instead of lower resolution textures.

A typical example

Possible Uses

Possible uses are, but not limited to:

  • Optimizing performance by reducing the amount of triangles drawn on screen by swapping loaded geometry for a lower poly mesh or one with properties turned off
  • Hiding unnecessary details that are hard to notice at a distance or are otherwise obscured by obstructing geometry, cutting back on overdraw
  • Switching to a less detailed particle system
  • "Transforming" the mesh based on distance by swapping in a completely different mesh.

Details

NiLODNode can only display one Node at a time, and requires each child to be a type of Node (NiNode, BSOrderedNode, NiBillboardNode, BSDamageStage, etc) whose mesh contents are not skinned, and in proper order of diminishing detail. The three unique fields are:

  • Switch Node Flags: Consists of two flags. UpdateOnlyActiveChild tells the game to only update visible Nodes. UpdateControllers tells the game to update the controllers of the visible Node on LOD level change, however certain Node flags can overrule this.
  • Index: Determines is which child is the default state, it should always be set to 0.
  • LOD Level Data: Can either be NiRangeLODData, which is 1:1 to Morrowind's NiLODNode extents, or NiScreenLODData, which handles LOD by means of a Bound, similar to BSOrderedNode.

NiRangeLODData

NiRangeLODData consists of three fields:

  • LOD Center: The absolute origin used to determine the distance for Node swapping. Unaffected by other transforms in the scene.
  • Num LOD Levels: Total number of LOD Levels, should always match the number of child Nodes in NiLODNode.
  • LOD Levels: The extents of each child Node in NiLODNode. Effectively a minimum-maximum range. (Cells are 4096 units, and are by default loaded in groups of 5, for example.)

NiScreenLODData

The results of NiScreenLODData vary, as it determines which child Node should be visible based on the percentile proportion of the screen its Bound occupies. The game uses the last child Node as the lowest level of detail automatically, and it must contain one less Proportion than the number of child Nodes in NiLODNode. It consists of four fields:

  • Bound: Object's local Bound. Not used for LOD calculation. If Radius is left empty, game will auto calculate all Bound sizes on load.
  • World Bound: Spherical Bound defining object's size; used to calculate its screen proportion.
  • Num Proportions: The total number of Proportion (LOD) Levels. Must be "Child count - 1".
  • Proportion Levels: A percentage threshold (0.0 - 1.0 range) of how much of the Bound needs to occupy the screen in order to switch the LOD level.