3D Tree LOD Model

3D tree LOD models or hybrid tree LOD models are optional LOD assets for ultra tree LOD generation. If a such a LOD assets does not exist, the tree LOD billboard will be used instead.

A 3D tree LOD model is an optimized and/or low poly version of a full model tree, similar to any other object LOD model. A hybrid tree LOD model specifically means a mixture of 2D billboard trunks and 3D leafs/crowns from the full model trees.

The 3D parts should have all tree animation and collision removed, preferably reduced polygon count and and clamped UV texture coordinates (UV coordinates need to be >= 0.0 and <= 1.0) allowing for textures to be atlassed.

In order to match 3D tree LOD models to full models, the filenames of the 3D tree LOD models contain the CRC32 checksum of the full model. With both the filename and the CRC32 checksum, shared archives of 3D static LOD models for trees can be created without having to worry about load order or overwrite order as each version will have a unique LOD filename. For example, the filename for a full model tree with the filename treepineforest01.nif and a CRC32 checksum of 8E204123 becomes treepineforest01_8E204123passthru_lod.nif.

Check ..\DynDOLOD\Logs\DynDOLOD_[GAME MODE]_Tree_Report.txt for the 3D tree LOD model filenames that are being looked for. There will be an entry like 3D LOD model not found treeaspen01_XXXXXXXX. That means the filename is should be treeaspen01_XXXXXXXpassthru_lod.nif.

The passthru in the filename causes LODGen to keep any LightingShader settings instead of using the default LOD shader settings. This is important for lighting to be closer to full models. If not used with care, this can generate *.BTO with invalid shader settings causing the game to CTD. All files included in the DynDOLOD Resources are of course valid - use them as a guideline to verify valid shader settings.

As a last ditch effort before using the billboard as fallback, DynDOLOD checks if there is an object LOD model with the typical filename convention of full model filename_LOD_[0|1|2].nif as usual for object LOD. This should only be used by properly made mods that use new unique filenames for every changed full model or texture and use new or updated base records to use the new assets to avoid conflicts. As soon as there are different variants (even through updates or patches) for the same full model filename, use the preferred CRC32 matching to guarantee the correct LOD model is used every time regardless of a user's load order since users like to mix lots of different mods or different versions of mods and their assets all the time.

Note that LOD only has binary alpha with a fixed threshold of 128. DynDOLOD reads the alpha threshold from the NiAlphaProperty from the models used for LOD and adjusts the textures before it is added to the atlas texture. The final result in game may be to thick or thin like certain objects seem to be missing or transparency looks off. Try adjusting the NiAlphaProperty in the 3D LOD model. Again, note that the UV texture coordinates need to be >= 0.0 and <= 1.0 for LOD being able to use the atlas texture. If the UV is outside those limits, LOD will use the texture directly.

Note that by default mipmaps of textures that are added to the tree LOD or object LOD texture atlas are ignored and instead are generated from the largest resolution with an alpha-to-coverage algorithm so that small details do not fade into full transparency the further away they are. To use the mipmaps of the original texture defined by the LOD model, add the term UseMipMaps to the BSTriShape/NiTriShape name. This should preferably be done for all LOD models using this texture. Use an unique filename for such textures, so there are no problems with other mods modifying the same vanilla filenames.

Create Hybrid Tree LOD Models

Hybrid tree LOD models use a billboard style trunk and 3D crown (leaves and branches) from full models.

The basic idea is to split a full model into two static (collision, animation, skin, bone data etc. removed) files. The trunk NIF and the crown NIF. TexGen renders the trunk billboard from the trunk NIF. Then LODGen is used once to create the hybrid tree LOD model with the trunk billboard text file data and the crown NIF. The resulting hybrid tree LOD model and the trunk NIF are then shipped with the mod.

Full model tree separated into trunk and crown shown in NifSkope


Use TexGen to automatically generate trunk billboards.

If the tree uses a non vanilla trunk, create a new trunk NIF in the data folder ..\Data\DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\[TREEMOD]\*.nif that only contains the shape of the tree trunk. Skinned shapes are not supported.

The filename should match that of the hyrid model (*_XXXXXXXXpassthru_lod.nif) with passthru_lod replaced by _trunk, e.g. *_XXXXXXXX_trunk.nif.

XXXXXXXX stands for the CRC32 of the full model.

See ..\DynDOLOD\Edit Scripts\DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\sbt\ as example.

Run TexGen with the Tree/Grass LOD Billboard Rendered option checked to generate/update the trunk billboards.

TexGen renders diffuse and normal textures of the trunk NIF from the front (*_1.dds) and a side (*_2.dds) view and a txt file with dimension information.

Crowns (Leaves and Branches)

Create a new crown NIF that only contains the leaves and branch shape(s) in a dedicated input folder. Skinned shapes are not supported.

All UV coords of the crown should be between 0.0 and 1.0 to avoid wrapping/tiling. Either edit the UV in NifSkope (right click BSTriShape/NiTriShape, Texture, Edit UV) or set Texture Clamp Mode 0 CLAMP_S_CLAMP_T on the shader property.

If the UV is not edited or clamped, LODGen will add vertices and triangles in order to split the UV. This will cause a recalculation of normal vectors. If the crown lighting appears off afterwards, consider adding the term SphereNormals to the BSTriShape/NiTriShape name.

The shader settings and full textures typically do not need to be changed. Default and Glow shaders are supported by the engine. Parallax or other shaders might need to be converted (CTDs or broken visuals in the game will make that obvious).

The filename should be that of the final hybrid model (*_XXXXXXXXpassthru_lod.nif).

XXXXXXXX stands for the CRC32 of the full model.

See ..\DynDOLOD\docs\trees.ultra\tools\hybrids\input\sbt\ as example.

Combining Trunks and Crowns (Leaves and Branches)

Use LODGen to automatically combine the trunks and crowns into hybrid tree LOD models.

Use notepad to edit ..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.txt to change the PathInput folder for the crowns NIF location, PathOutput for the desired output location and PathData to the trunk billboards location.

The default settings expect the trunk billboards in the current DynDOLOD installation relative default TexGen_Output folder location.

Edit FlatNif= to change the template NIF, which is used to build the 2/4 panes trunk shapes.

template4.nif uses 4 separate panes, which will react better to lighting. It is recommended to use it.

template2.nif is similar to billboard tree LOD, using 2 double sided panes.

Execute ..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.bat to run LODGen with hybrid.txt to create the hyrbid tree LOD models.

In case a trunk billboard *_XXXXXXXX_trunk.txt can not be found in the same sub folder structure of the TexGen output, it will try to find a matching vanilla trunk billboard.

For example, the crowns in ..\DynDOLOD\docs\trees.ultra\tools\hybrids\input\rat\ use the same trunks as their corresponding vanilla trees, so no new trunks are needed to be rendered for them. The crowns ..\rat\treeaspen01_3E0148AFpassthru_lod.nif will be combined with the ..\treeaspen01_trunk.txt billboard, because there is no ..\rat\treeaspen01_3E0148AF_trunk.txt.

When the trunks and crowns are combined, the shape names automatically get "Crown" or "FlatTrunk" added to them. When LOD is generated these serve as indentifiers for the CrownBrightness and FlatTrunkBrightness settings.

Combined trunk and crown hybrid as shown in NifSkope

Shape Names

Terms added to BSTriShape/NiTriShape names are used to identify shapes or to control features. Applies to any model used for object LOD generation.

  • crown - used to identify shape for CrownBrightness INI setting. See 3D Tree LOD Brightness.
  • donothing - does nothing.
  • fixednormals - do not transform normals. See Internal Billboards and External Billboards.
  • flattrunk - used to identify shape for FlatTrunkBrightness INI setting. See 3D Tree LOD Brightness.
  • passthru - do not modify shader for this shape. Same as "passthru" added to LOD filename which applies to all shaders of a NIF.
  • spherenormals - adjust normals like they originate from a center point of the model. See Internal Billboards and External Billboards.
  • scalexy - scale shape in x and y direction by the ScaleXY=value defined in export file. Not used.
  • trunk - used to identify shape for TrunkBrightness INI setting. See 3D Tree LOD Brightness.
  • noreuv - do not try to move or split UV of shapes that have UV coordinates outside 0.0 and 1.0. This can affect performance negatively. Create LOD models with proper UV for the textures or stitched object LOD textures. Being able to use the object LOD texture atlas is more important for performance than triangle count.
  • usemipmaps - if the textures used by this shape are added to the texture atlas, use original mipmaps instead of generating them. See above.
  • noatlas - the shape in the object LOD mesh will use the full texture as is. This can affect performance negatively. Only use if a lot of trees in the same cell/area share the same shader settings and use the same full texture.

Hybrid Tree LOD Assets

To include the final hybrid tree LOD model in a mod, move it to the data folder ..\Data\Meshes\.. as usual. Typically it will be found anywhere because of the filename and CRC32 matching. It makes sense to keep the DynDOLOD convention, for example ..\Data\Meshes\DynDOLOD\trees\[TREEMOD]\*.nif.

The mod should also include the trunk NIF in the data folder ..\Data\DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\[TREEMOD]\*.nif.

This allows users to update the trunk billboard textures, in case simple texture replacers are used or to use different TexGen settings.

As long as the trunk NIF (or crown NIF) does not change, the final hybrid tree LOD models do not need to be updated. The crown NIF from the input folder does no need to be part of the mod.