Lumberyard
Legacy Reference

Exporting a Level of Detail (LOD)

Level of detail (LOD) techniques are used to increase performance and reduce draw calls by displaying progressively lower detailed objects the further they are from the camera. Generally, each LOD should have its vertices reduced 50% from the previous level and a reduction in the number of materials used. Lower LODs should also have multiple textures combined into one texture to further reduce draw calls.

Lumberyard supports using up to six LODs per group node in Maya. LOD number is from 0 (highest level of detail) to 5 (lowest level of detail).

You can export the following LODs from Maya to Lumberyard:

  • Static Mesh LODs

  • Material LODs

  • Skinned Mesh LODs

Static Mesh LODs

Use the following naming and setup to export Static Mesh LODs using the Maya Lumberyard tool.

LOD Naming

Use the following naming conventions for LODs.

  • _lod0_ through _lod5_ (prefix)

  • _group (suffix)

  • _helper (suffix)

LOD Setup

Basic LOD Setup: All LOD meshes need to be under a group node in Maya. You will need to add the _group suffix at the end of the name for your group node. The following example shows assets that have no animated parts and small assets that do not need to be split up for culling.

Advanced LOD Setup: Each set of LOD meshes needs to be under a group node in Maya. You will need to add the _lod#_ prefix at the beginning and _group suffix at the end of the name for your group nodes that contain these sets. The following figure shows an asset that has multiple meshes and a collision mesh that must be split into LODs that can be culled. The lowest LOD does not contain a Decals_mesh because by this LOD it will not be noticeable and the removal of it will save on performance.

Note

When exporting, under the Advanced Options panel, ensure that the Merge Nodes check box is not selected.

Material LODs

When you set up material LODs, you create submaterials and assign them to the appropriate LOD mesh.

For example, you might have a material group named Tree_Mats.

Within Tree_Mats, you set up five submaterials. The first three submaterials you assign to LOD0, which is the highest poly model. The other two submaterials you assign to the LOD1 mesh. This means that when LOD0 is active, it uses the first three submaterials you assigned to it. When LOD1 is active, it uses only the two submaterials you assigned to it.

Skinned Mesh LODs

Use the following naming conventions for Skinned Mesh LODs.

  • LOD0: Any name (no suffix or prefix required)

  • LOD1 through LOD5: Same name as LOD0 and suffixed with _lod1 through _lod5

  • Optional: _group node suffix to organize meshes in Maya (not required for exporting to Lumberyard)

When you export your skinned mesh LODs, each skin exports as an individual .skin file. The following images show how a set of exported skins look in each application.

Maya Outliner:

Lumberyard Exporter in Maya:

Windows Explorer:

You do not need to set anything else for the LODs within the .CDF. This is because when you assign the LOD0 (highest poly) skin mesh, the engine automatically handles swapping LOD meshes that follow the same naming convention for skins in the same folder.

To export skinned mesh LODs

  1. Ensure that your LOD0 through LOD6 meshes are named and suffixed appropriately. See the naming conventions described in the introduction.

  2. Open the Maya Lumberyard Tools. Make sure the Export window is visible.

  3. Select your LOD0 mesh. Click Add Selected to add it to the Geometry Export list.

    If it has skin weight data, the export type is automatically set to .SKIN.

  4. Select your LOD1 mesh. Click Add Selected to add it to the Geometry Export list.

    If it has skin weight data, the export type is automatically set to .SKIN.

  5. Repeat for the remaining LOD meshes.

  6. After you add all your LOD skinned meshes, assign the appropriate export path. Then export your skeleton (.CHR) as you would normally.

    Note

    All the LOD skinned meshes must be in the same directory for the LODs to work properly in Lumberyard.

  7. Open Lumberyard. Set up your .CDF, .CHR and .SKIN attachment(s) as normal.

    If the proper naming convention was followed, Lumberyard automatically handles the transition of the LOD meshes in-level.

To test the .CDF with LODs, drag the .CDF into the level and then move your camera back to watch the LODs transition.

Currently, there is no way to test the LODs within Geppetto. You can use the console variable e_DebugDraw = 1 to display debug text information regarding LODs. However, it may difficult to read if you have multiple skin attachments that have LODs, as the text stacks on top of each other.

LOD Distance Ratio

The LOD Distance Ratio is a ratio derived from the Max view distance and View distance multiplier values.

To easily test the LOD distance ratio's relation to the maximum view distance, leave the distance multiplier set to 1. A higher LOD distance ratio results in faster transitions through the LODs as the camera pulls away. Lower LOD distance ratio values effect slower transitions through the LODs.

For example, LOD transitions was tested for a tree that has LOD0-LOD2 and a Max view distance of 100 (m) and LOD distance ratio of 255. The tree transitioned from LOD0 to LOD1 around 15m away, and then from LOD1 to LOD2 around 25m away. When LOD distance ratio was set to 64, the tree transitioned from LOD0 to LOD1 around 40m away, and then from LOD1 to LOD2 around 75m away. Experimenting with these values showed that the calculation is not linear.

Debugging LODs

The following console variables can be used for debugging LODs:

  • e_DebugDraw = 1 - Name of the used cgf, polycount, and the used LOD.

  • e_LodCompMaxSize = 6 - (default value) Lower values force the LODs to load sooner.

  • e_LodRatio = 40 - (default value) LOD distance ratio for objects. Lower values force LODs to load sooner.

  • r_Stats = 6 - Displays the drawcall count for each object instance in the scene. The numbers above each object are broken into total DP, zpass, general, transparent, shadows, and misc.