UDN
Search public documentation

ImportingSkeletalLODs
Licensees can log in.

Red links require licensee log in.

Interested in the Unreal engine?
Check out the licensing page.

Questions about UDN itself?
Contact the UDN Staff

Importing Skeletal LODs

Document Summary: This document explains how to import a lower LOD (Level Of Detail) version of a skeletal mesh.

Document Changelog: Created by Andrew Moise.

Overview

Because updating all the bones and vertices of a skeletal mesh can be quite expensive, it is possible to use lower LOD (Level Of Detail) versions of the mesh when the character is seen from a distance. This can be a significant optimization when rendering many characters in a scene.

UnrealEngine 3 supports both Mesh and Bone LOD for skeletal meshes. Lower-detail meshes are created by an artist, and then imported as an LOD to use for an existing SkeletalMesh. Once you have added an LOD, you control at what distance that LOD is used in the game. When rendering a lower LOD version of a mesh, the animation system will only animate and update the bones required.

UnrealEngine 2 used to have code to automatically generate lower-poly versions of a skeletal mesh, but this functionality was removed as the results were far worse than artist-created LODs.

Creating A Low-LOD Mesh

When you import a lower-LOD version of a mesh, it should contain less triangles and less bones than the 'base' high-poly version. There are some requirements you must meet to use a mesh as an LOD for another:

  • When removing bones, they can only be removed from the ends of the hierarchy. So removing fingers is a good idea for an LOD, but you cannot remove bones from the spine for example.
  • The root bone for the base mesh and the LOD should be the same.
  • The hierarchy of the base mesh and the LOD must be the same.

It is often a good idea to only have one influence per vertex in lower LOD versions of a mesh, as this reduces the skinning cost. A warning will pop up if you import an LOD with 'soft' vertices in it, though this warning can be disabled in your ..Editor.ini file (the CheckSingleInfluenceLOD flag in the AnimSetViewer section).

Viewing LODs

There are some buttons on the toolbar of the AnimSetViewer that allow you to see how the different LOD levels for a mesh look:

LODButtons.jpg

Auto Select the LOD level to use automatically, based on the size of the mesh on the screen. This allows you to preview how the mesh will look in-game.
B Force the display to use the `Base' mesh (ie LOD 0).
1 Force the display to use LOD 1.
2 Force the display to use LOD 2. This is gray in this case, as there is no LOD 2 imported for this mesh.
3 Force the display to use LOD 3. There is no LOD 3 imported for this mesh.

There is also some information at the top of the 3D viewport showing the currently used LOD, as well as its vertex and bone count. If you have `Show Bones' or `Show Bone Name' turned on in the AnimSetViewer, it will only display bones being updated for the currently displayed LOD.

Importing An LOD

First open the AnimSetViewer with the SkeletalMesh that you want to add an LOD to. Then under the `File' menu select `Import Mesh LOD'. You will be asked to specify the PSK file that contains the lower-detail version of that mesh. Once you have selected the .PSK to import, a combo box will pop up allowing you to choose which LOD level to import this mesh as. LOD 0 is the `base', or highest poly mesh. LOD 1 is the first step down and so on. Importing at an LOD that already exists will replace the existing LOD mesh.

If your import goes successfully and does not generate any errors, you can press the appropriate `Force LOD' button on the toolbar to see if your mesh came in correctly.

Configuring An LOD

There are some settings you will need to adjust for your LOD to work properly. Each LOD level has an entry in the LODInfo array under the `Mesh' tab on the right.

LODInfo.jpg

You can ignore entry 0 in this array, as that is the `Base' mesh.

DisplayFactor This controls how big the mesh must be on screen before that LOD is used. A smaller number means the LOD will be used when the mesh is further away. You can see the current DisplayFactor for the preview of the mesh at the top of the 3D window. The DisplayFactor for each successive LOD level should be smaller than the last.
LODHysteresis To avoid meshes `flickering' between two LOD levels when right on the boundary between them, this parameter allows you to introduce some `bias' when transitioning from simple to complex versions.
LODMaterialMap LOD versions of a mesh must use the same materials as the base mesh. However, when you import a mesh the materials may be imported in a different order. This array allows you to choose which element of the SkeletalMesh's Materials array maps to each section of the LOD.

Materials And LODs

The easiest way to set up an LOD is to have it use the same materials as the Base mesh. Because each SkeletalMeshComponent (instance of a skeletal mesh) has its own Materials array which allows you to override materials in the SkeletalMesh Materials array, you want to keep all the materials you use at any LOD in that array. An example of per-instance override would be applying different team skins or faces. However, if you do want to create an LOD which uses a material not used by the base mesh, this is still possible. Add a new element to the Materials array in the SkeletalMesh, which will be unsused by the base mesh, and put the new material there. Then use the LODMaterialMap for that LOD to point to that new slot.

LOD, Sockets and PhysicsAssets

You can only create sockets to bones that appear in all LODs. When you create a new socket, only bones in all LODs will be offered in the bone selection combo. If you try and import a new LOD which is missing a bone required for a socket, you will get an error.

Bones required by the PhysicsAsset are always updated, even if not required by that LOD's mesh. This is because they are used for per-bone collision detection, which should not change when someone is further away from you.