Guide:Creating Tree LOD Models
WIP
This process requires DynDOLOD 3. I have adopted several shortcuts and a more refined process since originally writing this article and will update it if I ever have the gumption to do so. I believe it's instructive as-is until that time.Purpose & Background
For complete reference, see the official DynDOLOD documentation describing this process. This is meant to be a simplified, quick-start guide. The goal is to aid other mod authors in operationalizing the methods described in the official documentation in order to produce LOD for their tree mods or for updates to existing tree mods.
Like most object LOD, DynDOLOD-compatible tree LOD uses a simplified LOD model 'imposter' or 'dummy' version of the full model in order to render trees in object LOD while keeping the performance hit to a minimum. In order to accomplish this, DynDOLOD must be able to associate the LOD model with its corresponding full model, which can be problematic with the "rule of one", because these are 'paired' assets (each tree mesh has a single corresponding LOD mesh). This can be done in one of two ways (in order of descending preference):
- Option 1 - Incorporating the CRC32 checksum of the full tree model into the LOD asset names - LOD asset conflicts are not possible. This is the de facto standard, since most existing tree mods reuse vanilla tree names or those from other tree mods. It is also the preferred approach, according to sheson.
- Option 2 - Using unique (new) tree names via plugin and for LOD assets - LOD asset conflicts with other mods are not possible.
If LOD models are saved using the base tree file names only (e.g., treeaspen01_passthru_lod.nif), then any load order with multiple treeaspen01 LOD will generate the LOD for one in accordance with the "rule of one" for the LOD tree model. This will potentially lead to improper paring of base model with an incompatible LOD model. Using CRC32 of the base model in the LOD model file name and texture paths guarantees unique pairing of a base model with its correct LOD model.
General Procedure
LOD models should contain only BSTriShape or NiTriShape blocks (and on rare occasions, NiNode) with static trunk and crown. This can be done in NifSkope by either copying these blocks into an 'empty' NIF containing only a single root block or by stripping the base model down to these blocks. Each method has its pros and cons in terms of time and points of error.
- The "copy-to" method is more work manually adding tree names and CRCs to files on save.
- The "strip-from" method is more work running xEdit and applying the script,
..\DynDOLOD\docs\trees.ultra\tools\DynDOLOD_CRC32Gen.pas
, to add CRC32 to the base models followed by stripping extraneous blocks and data in NifSkope before saving.
The LOD models are saved out in either case. There are two choices for accomplishing this, and each has it's advantages:
- Standard LOD models (less work, lower in-game performance) can be created by simply copying each block (or stripping down the base model) and saving into
meshes\DynDOLOD\lod\trees\[TreeName]_[CRC32]passthru_lod.nif
. The tree LOD model is ready for use by DynDOLOD end users. - Hybrid LOD models (more work, better in-game performance):
- Copy (or strip) trunk blocks, saving as
DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\[TreeName]_[CRC32]_trunk.nif
into the target mod. - Copy (or strip) crown blocks, saving as
..\DynDOLOD\docs\trees.ultra\tools\hybrids\{UniqueModOptionID}
- Run TexGen 3 with only the "Render" option ticked to generate output containing the new trunk billboard textures. NOTE: The tree mod with added trunks must be enabled in the mod list.
- Use
..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.bat
to combine the crown and flat trunks into the final LOD model, and place this intomeshes\DynDOLOD\lod\trees\[TreeName]_[CRC32]passthru_lod.nif
of the tree mod. The tree LOD model is ready for use by DynDOLOD end users.
- Copy (or strip) trunk blocks, saving as
Given the gist of the process outlined, any number of workflows can be devised based upon tools, resources, and methods used. Below, one such approach is outlined in detail.
Prepare Working Environment
Mod Organizer (MO) is the mod manager used in this process, but this is not a requirement. Extrapolate these instructions for other contexts.
Before beginning work on creating LOD for a tree mod, it's best to first verify that the base models are 'final', because any changes will obviate all LOD work, since the reference CRC32 will change with updates. Work with the mod author to correct any potential issues with UV, alpha threshold, texture paths, lighting, unused strings, block names, etc. if there are any. Running trees through a NIF optimizer is fine, but this can 'break' some tree models, causing invisible trees. If this step is done, be certain to test the mod afterward and keep in mind that the author of the tree mod should be hosting these files, or permissions must be granted by the author to upload these with the corresponding revised LOD models where applicable.
- Optional: Consider reviewing the System Setup Guide to configure the modding environment.
- Install DynDOLOD configured with DynDOLOD Resources mod.
- Download NifSkope, and extract the archive into any location. This is a portable application, so it has no installer.
- Download SSE NIF Optimizer, and extract the archive into any location. Like NifSkope, this is a portable application.
- Optional: Install WinMerge for comparing like-named tree meshes.
- Optional (copy-to method): Configure 7-zip Explorer shell context menu options to provide a CRC32 lookup (see image at right).
- Optional (strip-from method): Install xEdit, and configure it to launch from the mod manager (MO instructions).
- Use a mod-manager profile that is lightly modded without a bunch of replacers that could conflict with the tree mod (TexGen may also run a bit faster):
- Install SKSE and any desired "engine-level" Extender mods and Resource mods.
- Install/enable the relevant tree mod. If the mod has many different options for trees that use different model variants with same file name, or if texture paths are different, then each variation must be installed into a different mod.
- Example: EVT has Basic and Lush options, and both have SFO and RAT options as well as dark mesh options, while only the Lush option has large trees, so the mods installed might be ...
- EVT-Basic
- EVT-Basic-Darker
- EVT-Lush
- EVT-Lush-Darker
- EVT-Lush-Large
- EVT-Lush-Large-Darker
- EVT-SFO
- EVT-RAT
- Example: EVT has Basic and Lush options, and both have SFO and RAT options as well as dark mesh options, while only the Lush option has large trees, so the mods installed might be ...
- Create the following directories in the tree mod(s). Right-click on the mod in MO left pane, and select "Open in Explorer".
meshes\DynDOLOD\lod\trees\{UniqueModOptionID}
- Location of the final LOD modelsDynDOLOD\Render\Billboards\DynDOLOD\lod\trees\{UniqueModOptionID}
- Location of the trunk models rendered to create trunk billboards
Workflows
Strip-From Workflow
This is a bit faster than my "copy-to" method. Basically, the redundant nodes are stripped from the full tree nif that has been renamed to the LOD model name and saved as the trunk, re-opened, and saved as the crown. This is vague, I know, so try the method in the next section, and it may be clearer.
Copy-To Workflow
- Open
..\DynDOLOD\docs\trees.ultra\tools\emptypassthru_lod.nif
, and change the Header / BS Header / BS Version from 83 to 100 (converts to SSE format), and save into the following new files. These will be used as templates for the trunks/crowns. Replicating them here makes them reusable in the future:..\DynDOLOD\docs\trees.ultra\tools\empty_trunk.nif
..\DynDOLOD\docs\trees.ultra\tools\empty_passthru_lod.nif
- Now copy each of these into the working directories so they remain conveniently available while working on each tree model. When finished, there will be three Exporer windows open (keep these Explorer windows open throughout this process):
- In MO, right click on the relevant tree mod in MO left pane, and select "Open in Explorer"
- Right-click
meshes\landscape\trees
directory, and select "Open in new window". This is the source for the full models. - Create path, and paste:
DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\{UniqueModOptionID}\empty_trunk.nif
. This is the destination for trunk models. - Paste into DynDOLOD directory:
..\DynDOLOD\docs\trees.ultra\tools\hybrids\{UniqueModOptionID}\empty_passthru_lod.nif
. This is the destination for the crown models. NOTE: In the case of the EVT example above, each of the mod options must have a corresponding folder at this location.
- Arrange the three Explorer instances of these working directories in a way that facilitates ease of access to each (e.g., base tree models at left, and the two LOD directories at right with trunks at top and crowns at bottom).
Copy Mesh Parts Into Empty NIFs
As mentioned in the General Procedure section above, a "copy to" or "strip from" procedure can be used to create the LOD models. The former is described here.
Again, LOD models can be either:
- Hybrid LOD models - Applies ONLY to symmetrical trees with 1) branchy or leafy crowns AND 2) relatively straight trunks (more work to create, better performance, equal quality to 'standard')
- Standard LOD models - Applies to any tree type (less work to create, higher performance cost)
Additionally, only trees roughly ≥ 500 units tall (on the Z axis) should be considered for LOD models. Ignore the remainder, since they really can't be seen amidst other trees in the distance. Keep in mind the scale of the tree. Obviously, if the tree is 1.5 scale, the the threshold height is roughly 500 / 1.5 = 333 units tall. Note that some trees are scaled via plugin (e.g., Happy Little Trees) and not the mesh directly, so height is more of a guessing game. Suffice it to say that large trees should have LOD and small trees are optional, since they will be hard to notice unless other trees and plants are sparse. Aside from this, ANY tree (or tree part) can have a LOD model and a slight increase to performance cost for the end user.
NOTE
When creating 'standard' LOD models, all of the following step having to do with trunk meshes should be ignored. Instead, only follow the steps dealing with crowns. Instead of saving only tree crowns, all applicable mesh parts will be saved into the 'passthu' NIF, which will essentially be the final LOD models for packaging into the mod.- Since *.NIF files are associated with NifSkope ...
- Double-click on the empty crown NIF, and drag this to lower left.
- Double-click on the empty trunk NIF, and drag this to the (nearly) top of the right (the trunks Explorer window should be slightly exposed above this NifSkope instance).
- Double-click on the base model in the left window to open the model, and drag this to the left.
- Click on the trunk in the NifSkope viewer of the base model (it should be the active window). This will expose the *TriShape block in the left pane of NifSkope.
- Click on the *Trishape block to select it, and use Ctrl+c to copy to clipboard.
- Bring the empty trunk NIF info focus via the desktop or the taskbar.
- Click on the BSFadeNode in the left pane of NifSkope to select it, and use Ctrl+v to paste. The tree part should appear in the NifSkope viewer. Ignore the fact that it is off center or if it seems too small. Some trunks have > 1 mesh, so be sure to copy/paste each one likewise if it will likely be evident in LOD.
- NOTE: If it is a branchy tree and much of the crown is also selected, the tree should NOT have a trunk component. It will need to be treated as a "standard LOD model" by pasting all blocks into the empty crown NIF (see following step).
- Back in the base model instance of NifSkope, click on the crown. This will expose the *TriShape block in the left pane of NifSkope. The corresponding mesh should become highlighted in the NifSkope viewer.
- Click on the *Trishape block to select it, and use Ctrl+c to copy to clipboard.
- Bring the empty 'passthru' (crown) NIF info focus via the desktop or the taskbar.
- Click on the BSFadeNode in the left pane of NifSkope to select it, and use Ctrl+v to paste. Many crowns have > 1 mesh, so be sure to copy/paste them all in the same manner. The crown mesh(es) should appear in the NifSkope viewer and should align proportionately with the others if there are multiple meshes. If they don't, align, then this is likely a *TriShape block under another block. Expand blocks in the left pane and click on each one to inspect it in the viewer to find alternative *TriShapes. Skinned trees have duplicate meshes, so getting the correct one can be tricky and this nuance is beyond the scope of this article (and the author's knowlege). Just know that the 'correct' *TriShapes will become more evident with experience.
- NOTE: If any mistakes are made when pasting a mesh into the empty NIF, close and start over with another copy of the empty NIF (available in the working Explorer windows). This is simpler than deleting blocks or cleaning up unused strings and the like.
- Once all crown meshes are pasted into the empty passthru NIF, it's time to save the LOD models. If the trunk NIF wasn't needed or used (due to the model requiring the "standard LOD model" or if using the faster and more performance UNfriendly approach described previously), then the model is essentially created and should be saved ... read on.
- Close the NifSkope instance of the base model (without saving!). The Explorer instance with the base models will appear at left with the model chosen faintly highlighted.
- Slow-click the faintly-highlighted base model to bring up the name editor (which should highlight the entire file name without the '.nif' suffix).
- Right-click and copy this string.
- In the crown NIF that should still be visible at right, click on the save icon > "Save as". This brings up the "Save as" dialog with the file name of the crown NIF (
empty_passthru_lod.nif
. - Select 'empty' in the string and Ctrl+v to paste/replace.
- Back in the Explorer instance with the base models, right click on the same file from which the tree name was copied, and select "CRC SHA" > "CRC32" (Tip: the last file clicked on will be faintly highlighted). This will open up the CRC32 dialog (thanks to 7-zip).
- In the CRC32 dialog, double click the CRC32 value to open it in a new window from which it can be copied by double clicking and selecting Ctrl+c.
- Paste this just before 'passthru' in the file string of the "Save as" dialog in NifSkope (e.g.,
TreeName_XCRC32XXpassthru_lod.nif
). - After pasting, the cursor will be just to the right of the last CRC32 character and just before the 'p' in 'passthru'. Hold Shift and click just before the beginning of 'TreeName', and select Ctrl+c to copy the unique string to be used in the trunk file name.
- Save the crown to close the dialog, and then close the 'crown' NifSkope instance.
- Go to the 'trunk' NifSkope instance at upper right, click the file icon > "Save as", select 'enpty' again from the file name (
empty_trunk.nif
), and Ctrl+v to paste the unique string and close the dialog. - Close the 'trunk' NifSkope instance.
NOTE
The three Explorer instances should again all be visible (with more/less overlap, depending on screen size of the desktop). Note that in the instance with the base models, the last tree completed should be faintly highlighted, which is convenient, since it's easy to lose one's place when many files are present.
Rinse and repeat all preceding steps for the remaining trees. Skip trees that are not LOD candidates (logs, most stumps, etc.). Throughout this process, the empty NIFs will always be available in the folders to shich the crowns/trunks are saved and NifSkope will conveniently save these assets to their correct respective directory locations.
If at any time, a tree opened in NifSkope is not a candidate for a hybrid model, save all LOD-worthy trunk/branch parts into..\DynDOLOD\docs\trees.ultra\tools\hybrids\output
instead of ..\DynDOLOD\docs\trees.ultra\tools\hybrids\crowns
(where the hybrid LOD models will be assembled). These will be standard LOD models.Auto-Generate the Hybrids
After all trees mesh parts have been copied into the empty NIFs and renamed as described, the crowns (and/or standard LOD models) located in ..\DynDOLOD\docs\trees.ultra\tools\hybrids\{UniqueModOptionID}
should be run through SSE NIF Optimizer to clean up redundancies and reduce file sizes where possible for better in-game performance. This is completely safe to do on the LOD crowns (and/or standard LOD models). NOTE: DO NOT do this on the base models, since that will change the CRC32 of models affected and render all LOD work meaningless for those models.
- First, delete the empty NIFs in the two Explorer instances at right.
- Run SSE NIF Optimizer on the folder (using default settings with SSE toggled),
..\DynDOLOD\docs\trees.ultra\tools\hybrids\{UniqueModOptionID}
. Check the log for this program to ensure no issues, which should be adjacent to the EXE. It's entirely possible that no changes will be made, but look at the modifies on date and the log to verify. - Open
..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.txt
:- If this directory does not contain an 'output' folder, create it.
- Change "PathData" by adding
{UniqueModOptionID}\
to the end of the path. - Change "PathInput" from
\input\
to\{UniqueModOptionID}\
.
- Refresh MO by hitting F5 or by activating the mod (recall that the trunk NIFs were saved to that mod, which should be overriding all other conflicting mods).
- Run Texgen 3 (DynDOLOD 3 required!), and ONLY tick the "Render" option. Other settings don't matter. TexGen will 'render' the trunk models and create multiple trunk billboard textures for each tree with a trunk model using information in the relevant plugin and Texconv.exe. This should take less than 10 minutes.
- Once TexGen 3 completes, carefully check for warning about missing textures or other errors pertaining to the trees in question. These issues will likely be due to the base model pointing to missing textures. It's simplest to find (or create) the textures and rename them to the paths indicated by the base model. These will need to be shared with the original MA, who should be notified anyway. Otherwise, they will need to be packaged with the LOD (which will effectively fix the tree mod as well).
- Execute
..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.bat
, which will produce the hybrid LOD models in..\DynDOLOD\docs\trees.ultra\tools\hybrids\output
(along side any standard LOD models that may or may not exist there from earlier work). - Check
..\DynDOLOD\docs\trees.ultra\tools\hybrids\LODGen_log.txt
for errors, and resolve them as necessary. It will usually be about a missing asset (TexGen/user issue), but it could be that file paths defined in..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.txt
are incorrect. TexGen by default sends its output to..\DynDOLOD\TexGen_Output
, and..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.txt
expects this as well. - Copy all LOD models from
..\DynDOLOD\docs\trees.ultra\tools\hybrids\output
intomeshes\DynDOLOD\lod\trees\
folder of the mod where the trunks were stored. - The LOD resource mod is now complete and will be used by DynDOLOD if enabled anywhere in the install priority.