Guide:Creating Tree LOD Models: Difference between revisions

From Step Mods | Change The Game
mNo edit summary
mNo edit summary
Line 19: Line 19:


== Specific Workflow ==
== Specific Workflow ==
Theoretically, one can do a whole bunch of trees from one working folder. In such cases, adding the CRC32 to the file names may be considered relatively tedious, since there is an xEdit script packaged with the DynDOLOD tools that can be used for those that want to spend the time to figure it out: <code>..\DynDOLOD\docs\trees.ultra\tools\DynDOLOD_CRC32Gen.pas</code>
Theoretically, one can do a whole bunch of trees from one working directory. In such cases, adding the CRC32 to the file names may be considered relatively tedious, since there is an xEdit script packaged with the DynDOLOD tools that can be used for those that want to spend the time to figure it out: <code>..\DynDOLOD\docs\trees.ultra\tools\DynDOLOD_CRC32Gen.pas</code>


Because most tree mods don't cover a lot of trees or reuse the same tree mesh names for many different optional variants, the xEdit CRC32 script may be more trouble that it's worth. It might be more convenient for updating changed CRC and internal texture paths (if it does this).
Because most tree mods don't cover a lot of trees or reuse the same tree mesh names for many different optional variants, the xEdit CRC32 script may be more trouble that it's worth. It might be more convenient for updating changed CRC and internal texture paths (if it does this).
Line 25: Line 25:
The following is what works best for me (I never 'update' LOD, as I think creating from scratch is less work and less prone to user error, since texture paths on BSShaderTextureSet node are automatically created via LODGen in the hybrid.bat process). ~[[User:z929669|z929669]] [[File:Ixian_Insignia.png|20px|link=User:z929669]] [[User talk:z929669|Talk]] 20:39, January 4, 2022 (UTC)[[File:7z-CRC.jpg|thumb|right|250px|7-zip context menu options]]
The following is what works best for me (I never 'update' LOD, as I think creating from scratch is less work and less prone to user error, since texture paths on BSShaderTextureSet node are automatically created via LODGen in the hybrid.bat process). ~[[User:z929669|z929669]] [[File:Ixian_Insignia.png|20px|link=User:z929669]] [[User talk:z929669|Talk]] 20:39, January 4, 2022 (UTC)[[File:7z-CRC.jpg|thumb|right|250px|7-zip context menu options]]
=== Prepare Working Environment ===
=== Prepare Working Environment ===
# Install 7-zip and be sure to configure its Explorer shell context menu options to provide a CRC32 lookup (see image at right).
# Install [https://github.com/niftools/nifskope/releases NifSkope], and associate it with NIF files (optional: configure to run via MO).
# Optional: Install [https://winmerge.org/downloads/?lang=en WinMerge] for comparing like-named tree meshes.
# Configure 7-zip Explorer shell context menu options to provide a CRC32 lookup (see image at right).
# Use a MO profile that is lightly modded without a bunch of replacers that could conflict with the tree mod (TexGen may also run a bit faster):
# Use a MO profile that is lightly modded without a bunch of replacers that could conflict with the tree mod (TexGen may also run a bit faster):
#* Configure relevant [[Concept:SkyrimSE_ModGroup_01-Tools|Tools]], and consider reviewing the [[Guide:System Setup Guide|System Setup Guide]] to configure the modding environment.
#* Configure relevant [[Concept:SkyrimSE_ModGroup_01-Tools|Tools]], and consider reviewing the [[Guide:System Setup Guide|System Setup Guide]] to configure the modding environment.
Line 43: Line 45:
#* <code>meshes\DynDOLOD\lod\trees</code>
#* <code>meshes\DynDOLOD\lod\trees</code>
#* <code>DynDOLOD\Render\Billboards\DynDOLOD\lod\trees</code>
#* <code>DynDOLOD\Render\Billboards\DynDOLOD\lod\trees</code>
# Copy <code>..\DynDOLOD\docs\trees.ultra\tools\emptypassthru_lod.nif</code> into the following new files. These will be used as templates for the trunks/crowns. Replicating them here makes them reusable win the future:
# Copy <code>..\DynDOLOD\docs\trees.ultra\tools\emptypassthru_lod.nif</code> into the following new files. These will be used as templates for the trunks/crowns. Replicating them here makes them reusable in the future:
#* <code>..\DynDOLOD\docs\trees.ultra\tools\empty_trunk.nif</code>
#* <code>..\DynDOLOD\docs\trees.ultra\tools\empty_trunk.nif</code>
#* <code>..\DynDOLOD\docs\trees.ultra\tools\empty_passthru_lod.nif</code>
#* <code>..\DynDOLOD\docs\trees.ultra\tools\empty_passthru_lod.nif</code>
# Now copy each of these into the working directories so they remain conveniently available while working on each tree model:  
# 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:  
## In MO, right click on the relevant tree mod in MO left pane, and select "Open in Explorer" (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" (keep these Explorer windows open throughout this process)
#* Right-click <code>>meshes\landscape\trees</code> folder, and select "Open in new window".
#* Right-click <code>>meshes\landscape\trees</code> directory, and select "Open in new window".
#* <code>DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\empty_trunk.nif</code>
#* Create path, and paste: <code>DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\empty_trunk.nif</code>
## <code>..\DynDOLOD\docs\trees.ultra\tools\hybrids\{ModNameWithoutSpaces}\empty_passthru_lod.nif</code>
## Paste into DynDOLOD directory: <code>..\DynDOLOD\docs\trees.ultra\tools\hybrids\{ModNameWithoutSpaces}\empty_passthru_lod.nif</code>
# Arrange the three Explorer instances of these working directories in a way that facilitates ease of access to each (base tree models at left, and the two LOD directories at right with trunks at top and crowns at bottom).
 
=== Creating the LOD Models ===
As mentioned in the General Procedure section above, 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.
: Since *.NIF files are associated with NifSkope ...
# Double-click on the base model in the left window to open the model, and drag this to the left.
# 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).

Revision as of 19:20, January 7, 2022

Delta c.png

Creating Tree LOD Models

A Quick Start to One Approach

by: The Step Team

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 three ways (in order of descending preference):

  • Option 1 - Using unique (new) tree names via plugin and for LOD assets - LOD asset conflicts with other mods are not possible. This is the preferred approach.
  • Option 2 - 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.
  • Option 3 - (not recommended) Reusing existing tree names (from vanilla or other tree mods) for LOD assets - LOD asset conflicts are possible.

General Procedure

LOD models should contain only BSTriShape or NiTriShape nodes (and on rare occasions, NiNode) from the base model copied/pasted into an 'empty' NIF using NifSkope, and removing any Parallax and Tree_Anim Shader Flags [1|2] from BSLightingShaderProperty nodes. This is a relatively simple task for most trees, but skinned trees or trees using BSMultiBoundNode can be a little trickier. Only the visually obvious nodes need to be copied (trunk and crown) and not the small details that will not be apparent at the distance of LOD. Click on the trunk and crown in the NIF viewer to expose the relevant nodes in the left pane of NifSkope.

  • Standard LOD models can be created by simply copying each node into an instance of ..\DynDOLOD\docs\trees.ultra\tools\emptypassthru_lod.nif and then renaming this into meshes\DynDOLOD\lod\trees\[TreeName]_[CRC32]passthru_lod.nif of the tree mod where 'TreeName' is the base file name of the reference mesh and 'CRC32' is the CRC32 checksum of the reference mesh. The tree LOD model is ready for use by DynDOLOD end users.
  • Hybrid LOD models will be more performance friendly, since they use flat trunks with between 4-8 triangles rather than the 'full' trunks which usually have upwards of tens to hundreds of polygons. These also require more work to construct, but uses the same ..\DynDOLOD\docs\trees.ultra\tools\emptypassthru_lod.nif saved into two separate files (one for crown and another for trunk).
    1. Copy trunk nodes into DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\[TreeName]_[CRC32]_trunk.nif of the target mod in the mod list.
    2. Copy crown nodes into ..\Any\Path\Outside\Of\Mod\List\[TreeName]_[CRC32]_trunk.nif of the target mod in the mod list.
    3. 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.
    4. Use ..\DynDOLOD\docs\trees.ultra\tools\hybrids\hybrid.bat to combine the crown and flat trunks into the final LOD model, and place this into meshes\DynDOLOD\lod\trees\[TreeName]_[CRC32]passthru_lod.nif of the tree mod. The tree LOD model is ready for use by DynDOLOD end users.

Specific Workflow

Theoretically, one can do a whole bunch of trees from one working directory. In such cases, adding the CRC32 to the file names may be considered relatively tedious, since there is an xEdit script packaged with the DynDOLOD tools that can be used for those that want to spend the time to figure it out: ..\DynDOLOD\docs\trees.ultra\tools\DynDOLOD_CRC32Gen.pas

Because most tree mods don't cover a lot of trees or reuse the same tree mesh names for many different optional variants, the xEdit CRC32 script may be more trouble that it's worth. It might be more convenient for updating changed CRC and internal texture paths (if it does this).

The following is what works best for me (I never 'update' LOD, as I think creating from scratch is less work and less prone to user error, since texture paths on BSShaderTextureSet node are automatically created via LODGen in the hybrid.bat process). ~z929669 Ixian Insignia.png Talk 20:39, January 4, 2022 (UTC)

7-zip context menu options

Prepare Working Environment

  1. Install NifSkope, and associate it with NIF files (optional: configure to run via MO).
  2. Optional: Install WinMerge for comparing like-named tree meshes.
  3. Configure 7-zip Explorer shell context menu options to provide a CRC32 lookup (see image at right).
  4. Use a MO profile that is lightly modded without a bunch of replacers that could conflict with the tree mod (TexGen may also run a bit faster):
    • Configure relevant Tools, and consider reviewing the System Setup Guide to configure the modding environment.
    • Enable SKSE and all other "engine-level" Extender mods and Resource mods.
    • The profile will obviously need DynDOLOD configured with DynDOLOD Resources mod.
    • 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
  5. Create the following directories in the tree mod. Right-click on the mod in MO left pane, and select "Open in Explorer".
    • meshes\DynDOLOD\lod\trees
    • DynDOLOD\Render\Billboards\DynDOLOD\lod\trees
  6. Copy ..\DynDOLOD\docs\trees.ultra\tools\emptypassthru_lod.nif 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
  7. 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:
    1. In MO, right click on the relevant tree mod in MO left pane, and select "Open in Explorer" (keep these Explorer windows open throughout this process)
    • Right-click >meshes\landscape\trees directory, and select "Open in new window".
    • Create path, and paste: DynDOLOD\Render\Billboards\DynDOLOD\lod\trees\empty_trunk.nif
    1. Paste into DynDOLOD directory: ..\DynDOLOD\docs\trees.ultra\tools\hybrids\{ModNameWithoutSpaces}\empty_passthru_lod.nif
  8. Arrange the three Explorer instances of these working directories in a way that facilitates ease of access to each (base tree models at left, and the two LOD directories at right with trunks at top and crowns at bottom).

Creating the LOD Models

As mentioned in the General Procedure section above, 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.

Since *.NIF files are associated with NifSkope ...
  1. Double-click on the base model in the left window to open the model, and drag this to the left.
  2. Double-click on the empty crown NIF, and drag this to lower left.
  3. 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).