Revision Difference
LODs#545962
<cat>Dev.Model</cat>
<title>LODs</title>
#Introduction
LODs are variant meshes that often have lesser geometry than its derived original. When an original model with high-quality meshes is viewed from far away, it can be swapped for an LOD-group of itself with lower quality meshes to improve performance, whilst the distant camera view of the player would see no respectable difference.
Similarly, it is also common for textures to be vested with mipmaps that interchange based on the camera's distance from its material surface.
LODs are variant meshes that often have lesser geometry than its derived original. When a model with high-quality meshes is viewed from far away, it can be swapped for an LOD-group of itself with lower quality meshes to improve performance, while the player would see no respectable difference.
Similarly, it is also common for textures to be vested with *mipmaps* that interchange based on the distance away from the material surface.
#Preparing LODs
LODs are easiest to make when derived directly from the various parts (or single part) of your original model. The mileage for creating LODs will vary based on your modelling software. A common practise is to make a copy of the original geometry and thereafter *decimate* it, which instructs the software to reduce the amount of vertices that the geometry consists of, while simultaneously compromising for as much of its original shape as possible. There may be other methods of simplifying a mesh convincingly at a distance and different software may offer differing tools towards doing so.
LODs are easiest to make when derived directly from the original model of highest fidelity. The mileage for creating LODs will vary based on your modelling software.
⤶
A common practice is to make a copy of the original geometry and thereafter *decimate* it, which instructs the software to reduce the amount of vertices that the geometry consists of, while simultaneously compromising for as much of its original shape as possible. There may be other methods of simplifying a mesh convincingly at a distance and different software may offer differing tools towards doing so.⤶
Once this has been done for the first iteration of an LOD, you can repeat the procedure above with stronger and stronger decimation over time, making sure that the geometry count decreases over each time. Every iteration is made part of a new LOD group that can be set further and further away from the original model. It may look unimpressive after a few iterations, but from far away it will be nearly impossible to tell.
<upload src="4e91c/8d977a0c018136b.gif" size="784095" name="e6UZHzwi2z.gif" />
You can also set up LODs to exclude smaller separable parts of the model that would never be visible from a long distance away, if decimating the geometry further is no longer viable.
#Moving into ModelDoc
Import the meshes of your model, including their LODs, into the ModelDoc node tree. It is generally a good idea to also associate all of your meshes and LODs with a default, or several bodygroups of your choice. This can also be automated by selecting the meshes in the node tree and right clicking:
<upload src="4e91c/8d977a1ef855222.png" size="110776" name="image.png" />
Once the meshes, and their LOD associates, are bodygrouped accordingly, it is time to add LODGroups in ModelDoc:
Once the meshes, and their LOD counterparts, are bodygrouped accordingly, it is time to add LODGroups in ModelDoc:
<upload src="4e91c/8d977a2ad58012c.png" size="9712" name="image.png" />
<note>The first LODGroup that is added is always referred to as LOD *0* by default, and it always has a visibility threshold of 0, meaning that this group is where you should designate the original model, and no LODs. Meshes that are never included in any LODGroup will also never be visible!</note>⤶
**LODGroup** simply refers to a single LOD group, so add or duplicate as many as you need. **LODGroupAll** is a unique group that contains meshes that should *always* be displayed, no matter the distance. This is useful for parts of the model that do not have LODs made for them, and thus should always be visible all the same at any distance.
⤶
LODGroups are sorted in the tree, according to their *switch threshold*. This threshold can be edited in each LODGroup node. It is a measurement of distance that can also be snapshotted from the ModelDoc viewport, via a button at the top of the node's property list:⤶
⤶
**LODGroup** simply refers to a single LOD group, so add or duplicate as many as you need. **LODGroupAll** is a unique group that contains meshes that should *always* be displayed, no matter the distance. This is useful for parts of the model that do not have LODs made for them, and thus should always be visible all the same at any distance.⤶
⤶
<note>The first LODGroup that is added is always referred to as LOD *0* by default, and it always has a visibility threshold of 0. This group is also where you should only designate the original model, and no LODs.
⤶
**Meshes that are never included into any LODGroup will also never be visible!**</note>⤶
⤶
LODGroups are sorted in the tree, according to their *switch threshold*. This threshold can be edited in each LODGroup node. It is a measurement of distance that dictates at whichever distance away that the model should interchange into the LODGroup in question. This distance can also be snapshotted directly within the ModelDoc viewport, via a button at the top of the node's property list:⤶
<bug>The slider of the switch threshold, at the top of the node editor, is clamped to values between 0 and 50. **Any higher value input into the adjacent box will get clamped down.** The workaround to this is to use the property input at the *bottom*, instead of the slider at the top. Their functionality is seemingly identical, but you may not be able to use snapshots of the viewport at longer distances.</bug>
<upload src="4e91c/8d977a59cf35f56.png" size="86063" name="image.png" />
The groups will be named accordingly, but to quickly add the corresponding meshes into each one, you can refer to the previous context menu and use the same automation technique. All second-rate LODs correspond to group *LOD 2* and so on:
##Example
Part name →| LODGroup
--- | ---
part.dmx | LOD 0
part_lod.dmx | LOD 1
part_lod2.dmx | LOD 2
... | ...
<upload src="4e91c/8d977a3cab315e3.png" size="110751" name="image.png" />
⤶
Once the meshes and their LODs are distributed and the LODGroups are given switch thresholds, the model can be compiled and you can immediately test the LOD functionality. Either via the Compiled Preview Outliner or via the LOD box on the upper bar.⤶
##Troubleshooting⤶
Once the meshes and their LODs are distributed and the LODGroups are given switch thresholds, the model can be compiled and you can immediately test the LOD functionality. Either via the Compiled Preview Outliner or via the LOD box on the upper bar.⤶
<upload src="4e91c/8d977a6fa24e20b.png" size="3109" name="image.png" />
You can also toggle *Rendering Info* in the viewport to get instantaneous feedback on the currently active LOD group.
<upload src="4e91c/8d977a79974d3e2.png" size="92926" name="image.png" />