TexGen Configuration

Stitched Object LOD Textures

Example of how full textures are stitched into object LOD textures.

TexGen uses simple text files to build stitched object LOD textures from existing full resolution single textures. Text files shipping with DynDOLOD are in ..\DynDOLOD\Edit Scripts\DynDOLOD\Configs\DynDOLOD_[GAME MODE]_TexGen_*.txt. In addition TexGen first searches for matching text files in the game folder ..\Data\DynDOLOD\. This way a mod author can package text files directly with a mod. Files found in ..\Data\DynDOLOD\ supersede files found in ..\DynDOLOD\Edit Scripts\DynDOLOD\Configs\ with the same filename.

TexGen reads from text files that adhere to a simple file naming convention. Any non alpha numeric character is stripped from the mods filename and then changed to DynDOLOD_[GAME MODE]_TexGen_[copy|alpha|noalpha]_[modfilenameesp].txt. The contents of such files is only read and executed if the plugin with the matching name is in the current load order.

The files that have the term _copy_ in their filename contain lists of 'source file.dds','destination file.dds' per each line to make specifically named 1:1 copies of existing full textures. This is needed because the process expects the normal map *_n.dds to have the same filename as the diffuse map *.dds. Have a look at an existing file like ..\DynDOLOD\Edit Scripts\DynDOLOD\Configs\DynDOLOD_[GAME MODE]_TexGen_copy_skyrimesm.txt as an example.

The files that have the term _alpha_ or _noalpha_ in their filename contain the information required to create the simple stitched object LOD textures, they are more or less direct derivatives from the full textures.

The output textures that are defined in _alpha_ keep the source alpha channel intact, while _noalpha_ strips the alpha channel. The distinction is required because LOD can only use transparancy (binary alpha) and the threshold is typically 128.

Have a look at an existing file like ..\DynDOLOD\Edit Scripts\DynDOLOD\Configs\DynDOLOD_[GAME MODE]_TexGen_noalpha_skyrimesm.txt as an example. The table below deciphers the data for each column.

0brightnesssigned integer: like for tree LOD, negative darker, positive brighter
1red-gamma-multiplierfloat, red|green|blue = Power(red|green|blue-gamma-multiplier, 1.0 / Gamma)
2green-gamma-multiplier
3blue-gamma-multiplier
4path\to\source\texture.ddsneeds to be in game data path, loaded BSA or current output path
5tilewidth-multiplierx|y * base size of tile on mini atlas
6tileheight-multiplier
7x-pos-multiplierx|y * base size for position of tile on mini atlas
8y-pos-multiplier
9path\to\destination\texture.ddswrites to output path
10x-atlaswidth-multiplierx|y * base size, defines final texture resolution of mini atlas
11y-atlaswidth-multiplier

Rendered Object LOD Textures

Example of how a NIF is rendered into object LOD textures.

Any NIF found in ..\DynDOLOD\Edit Scripts\DynDOLOD\Render\Skyrim\Objects\ and the game folder ..\Data\DynDOLOD\Render\Skyrim\Objects\ is renderd as an object LOD texture. The subfolder structure is kept.

The first shape should be a simple 4 vertex plane, which x and z values define the viewport of the render. The values itself do not matter. The width and height are integered so they match the Texture size or multiples thereof if one side is a multiple of the other. The shape name needs to contain the word 'TexGen' to be discovered. Use the scale 0.25, 0.5, 1, 2, 4 etc. to control the final texture resolution of the rendered texture.

The orientation has to be the front view. The rendering is done with orthographic projection.

Use the preview option to quickly test changes. Every time a NIF is selected in the drop down, the NIF and the textures will be read again from disk in case they changed in the mean time. You will have to reload TexGen in case the container (BSA, loose file) changes for an asset.

See the existing NIF in ..\DynDOLOD\Edit Scripts\DynDOLOD\Render\Skyrim\Objects\ for examples.

Technically all stitched object LOD texture could also be rendered. However, the information in the stitching text files is also used to automatically convert full textures and UV coords used by models in object LOD. So rendering should typically be used for complex object LOD textures that can not be stitched.

Tree/Grass LOD Billboards

TexGen determines which trees and grasses should have tree/grass LOD billboards automatically created for them based on the model volume and height.

A tree is every base record of the types 'TREE' and 'STAT' with the 'Has Tree LOD' flag set. Grass is every base record of the type 'GRAS'. TexGen supports ENB complex grass textures.

For the calculations, the 'OBND - Object Bounds' from the tree/grass base record are used.

OBND - Objects Bounds for a TREE base record shown in xEdit

The volume of the model is the result of v( (X2 - X1)2 + (Y2 - Y1)2 + (Z2 - Z1)2 ) and needs to be equal or greater than the Min[Tree|Grass]ModelVolume setting in ..\DynDOLOD\Edit Scripts\DynDOLOD\TexGen_[GAME MODE].ini.

For the height the Z2 value is used instead of (Z2 - Z1) - as Z2 is typically the height above the ground - and needs to be equal or greater than the Min[Tree|Grass]ModelHeight setting in ..\DynDOLOD\Edit Scripts\DynDOLOD\TexGen_[GAME MODE].ini.

In case the object bounds are not set properly in a plugin for the currently installed models (for example a mod replaced the vanilla models with smaller or larger versions), the Creation Kit Object Window has a right click context menu entry 'Recalc Bounds' to update them.

In addition, trees need to have the term 'tree' in their model path (this eliminates 'plants' for example). Grasses need to have an above water setting.

Whenever TexGen is used to generate tree/grass LOD billboards, it will also create text files ..\textures\terrain\lodgen\TexGen_[GAME MODE]_[Tree|Grass]_Billboards.txt which contain a list of all trees or grasses, regardless of any settings or failures. If the line ends in ',False' it means this tree or grass billboard was filtered out. For example:

Skyrim.esm;0006A9E6;TreeAspen01
Skyrim.esm;0005FADA;TreeAspen04,False

To force or disable tree/grass LOD billboard creation for a tree or grass, find its line in the file and copy it into a new file with a filename DynDOLOD_[GAME MODE]_TexGen_Billboards_[modfilenameesp].txt and remove or set ', False' accordingly. As explained above for the object LOD textures generation, the [modfilenameesp] represents the plugin filename with any non alpha numeric characters removed. The file should be in the ..\Data\DynDOLOD\ folder to supersede any files with the same filename in the ..\DynDOLOD\Edit Scripts\DynDOLOD\Configs\ folder.

Obvisouly it is impossible to force creation of a billboard in case the NIF or textures are missing, so pay attention to any error messages.

For example, in order to force tree/grass LOD billboard creation for the TreeAspen04 added by Form ID 0005FADA in Skyrim.esm for Skyrim Special Edition, the file path should be ..\Data\DynDOLOD\DynDOLOD_SSE_TexGen_Billboards_skyrimesm.txt.

The file should contain a line: Skyrim.esm;0005FADA;TreeAspen04

',False' can also be replaced by ',True' to the same effect. For example, the line can also be: Skyrim.esm;0005FADA;TreeAspen04,True

After adding the file or changing a line, open the 'Preview' window to check if the desired model is listed or delisted. It is enough to re-open the preview for the changes to take effect.

The file also allows overwriting the maximum scale which is discovered by scanning all references using the tree. The maximum scale is a factor to determine the tree LOD billboard texture resolution together with the Units per pixel setting in the TexGen options.

Skyrim.esm;0006A9E6;TreeAspen01,Scale=6.66
Skyrim.esm;0005FADA;TreeAspen04,True,Scale=6.66

Rendered

For billboards rendered from NIF files found in ..\DynDOLOD\Render\Billboards\ and their use, see the explanations about trunks at Hybrid Tree LOD Models.