This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Setting Up Object LODs

Using Levels of Details (LODs) is the main way to optimize your project. The point is to switch the high detailed mesh to a mesh with lower number of details when the mesh is far from camera. For that, you need to take your detailed model and create several versions of it, each with lower polygon count.

In UNIGINE, the mesh with LODs is a single object with a number of surfaces representing LODs. LODs settings allow you to specify the distance when a surface should be switched to another.

The mesh LODs can be created and set up in one of the following ways:

  • Automatically when importing the model into UNIGINE.
  • Manually by means of a 3D editor and UnigineEditor.

See Also#

Automatic LODs Setting#

Automatic LODs setting implies that LODs for the model are generated and set up on its importing into UNIGINE.

Notice
Automatic LODs setting can be found in the Content Optimization video tutorial.

Step 1. Export a Model From a Third-Party Software#

As an example, we will use the tubes_constructor_chrome_1120.fbx model from the Oil Refinery demo (available in UNIGINE SDK Browser). This FBX consists of several meshes, each of which represents an element of the tubes constructor.

To create and set up LODs on importing the model into UNIGINE, first, you should perform the following in a 3D editor:

  1. Create several meshes for different LODs of your model: a detailed mesh for the closest LOD and a number of less detailed meshes for farther LODs.
    Notice
    When naming the meshes, add a postfix to specify the LOD each mesh represents. For example: _lod_0 for the 1st LOD, _lod_1 for the 2nd LOD, etc.
    For example, for each mesh representing an element of the tubes constructor (10 meshes), there are 3 meshes representing LODs:

  2. Export the meshes as an .fbx file.

Step 2. Import Model to UNIGINE#

To import the model into UNIGINE, click Import in the Asset Browser and choose the exported FBX file. In the Import FBX window, perform the following to automatically create LODs based on the name postfixes:

  1. Enable the Combine By Postfixes option.
  2. Specify the number of LODs stored in the FBX container (in our case, 3).
  3. For each LOD define a postfix that will be used to group objects in an FBX file into a corresponding LOD.
    Notice
    The postfix must be the same as the one used when creating objects in a 3D editor.
    For the tubes constructor model, the following postfixes should be specified:

    The names of generated surfaces will be as follows: material_name + LOD_postfix.
  4. Specify minimum visibility distance for each LOD. Maximum visibility distance of each LOD is equal to the minimum visibility distance of the next LOD. Maximum visibility distance of the last LOD is equal to inf.

    • For _lod_0, leave the -inf value. It means that no matter how close the camera comes to the mesh, the surfaces will still be visible.
    • For _lod_1, set the distance at 5 units. It means that when the camera is 5 units away from mesh, the first LOD surfaces won't be visible and the second LOD surfaces will be shown.
    • For _lod_2, set the distance at 30 units. After 30 units, the second LOD surfaces won't be visible and the third LOD surfaces will be shown.
    Notice
    The Minimum and Maximum Fade distances should be adjusted in the Node tab of the Parameters window when the model is added to the scene.

In the result, the FBX container with 10 meshes will be imported. Each mesh will have 3 surfaces representing LODs.

Meshes of the Imported FBX

Notice
When working with large scenes, you cannot know for sure how many LODs some model will have. So, it is recommended to specify more LODs in the importer: in this case, you won't have to set up LODs manually, if the model contains more LODs than the previously imported one. For example, if you set up 10 LODs in the importer, you can import models with up to 10 LODs.

Step 3. Add Model to the World#

Add an exported model into the world as described here. All LODs will be already created and set up according to the specified import values:

Imported Tubes Constructor with LODs

FBX Added to the World

If required, adjust the LODs surfaces in the Node tab of the Parameters window:

  1. Set the Minimum and Maximum Fade distances for each LOD:
    • For the first LOD surfaces, leave the Minimum Fade distance 0 and set the Maximum Fade distance to 10 units. t will prolong the distance over which the LOD surfaces are still visible and provide smooth fading.
    • For the second LOD surfaces, set the Minimum Fade distance to 10 units. After 5 up to 15 units, the second LOD surfaces will smoothly fade in. The Maximum Fade distance set to 20 units. After 30 up to 50 units, the second LOD surfaces will smoothly fade out.
    • For the third LOD surfaces, set he Minimum Fade distance to 20 units. The third LOD surfaces will start to smoothly fade in from 30 to 50 units.
  2. Set the Min and Max Parents. Within this tutorial, we use the default values of 1.

Try to move the camera forward/backward to check how LODs are switched:

LODs Switching

Manual LODs Setting#

Manual LODs setting implies that LODs for the model are created in a 3D editor and LODs parameters are adjusted when the model is already imported and added to the scene.

Notice
Manual LODs setting is also shown in the Content Optimization video tutorial.

Step 1. Export LODs#

To export the mesh with LODs, do the following:

  1. In a 3D editor, create a detailed model and a number of models with a low number of polygons. For example, you can just copy the existing detailed model and reduce the number of polygons.
    Notice
    You should create a separate LOD for each part of the model to which a unique material is assigned.

    As an example, we will use the model of an oscilloscope from Superposition benchmark (available via UNIGINE SDK Browser). This model already contains 3 LODs.

    10109 polygons 5004 polygons 2583 polygons
    LOD 0
    LOD 1
    LOD 2
  2. Generate LODs according to a pipeline used by your 3D editor. For example, in 3ds Max, you should group meshes representing LODs and then create LODs via the Level of Detail utility.
  3. Export the model with LODs as an *.fbx file.

Step 2. Import Model to UNIGINE#

To import the model into UNIGINE:

  1. Click Import in the Asset Browser and choose the exported FBX file.
  2. In the Import FBX window, enable the Merge Static Meshes option. Otherwise, LODs will be imported as separate meshes, not surfaces.
  3. Import the model.

Step 3. Add a Model to the World#

Add an exported model into the world as described here. By default, all surfaces (LODs) are visible at the same time:

Oscilloscope Model

The surfaces of the exported model that represent LODs can be found in the Node tab of the Parameters window:

Step 4. Set Up LODs#

This section explains how to set up LODs of the mesh to smoothly switch a high detailed LOD to a low detailed when the camera begins to move away from the mesh. LOD surfaces have 3 parameters:

Notice
The chapter contains the example values of the parameters. You can specify your own ones, if necessary.

Visibility and Fade Distances

For each LOD surface, you should specify a visibility distance and a fade distance. For setting up the LOD surfaces, do the following:

  1. Open the World Hierarchy window, and choose the added node.
  2. In the Surfaces group of the Node tab (the Parameters window), choose the first LOD surface:

    • Set its Maximum Visibility distance to 5. It means that when the camera is 5 units away from mesh, the first LOD surfaces won't be visible.
    • Leave the Minimum Visibility distance at -inf. It means that no matter how close the camera comes to the mesh, the surfaces will still be visible.
    • Set the Maximum Fade distance to 10 units. It will prolong the distance over which the LOD surfaces are still visible and provide smooth fading.

    Notice
    You can disable other LOD surfaces to see the result of the current LOD surface settings.
  3. Choose the second LOD surfaces and:
    • Set the Minimum Visibility distance of the second LOD surfaces to start exactly where the Maximum Visible distance of the first LOD surfaces ends: at 5 units. It means that when the first LOD surfaces begin to fade out, the second LOD surfaces will be shown.
    • Set the Maximum Visibility distance at 30 units. After 30 units, the second LOD surfaces begin to fade out and the third LOD surfaces will be shown.
    • Set the Minimum Fade distance to 10 units. After 5 up to 15 units, the second LOD surfaces will smoothly fade in.
    • Set the Maximum Fade distance to 20 units. After 30 up to 50 units, the second LOD surfaces will smoothly fade out.

  4. Choose the third LOD surfaces and:
    • Set the Minimum Visibility distance to 30 units. It means that when the second LOD surfaces begin to disappear, the third LOD surfaces will be shown.
    • Set the Maximum Visibility distance at 300 units. After 300 units the third LOD surfaces totally disappear.
    • Set the Minimum Fade distance to 20 units. The third LOD surfaces will start to smoothly fade in from 30 to 50 units.
    • Set the Maximum Fade distance to 50 units. After 300 units, the mesh will begin to smoothly fade out.
      Notice
      If you want to leave the last LOD surface always visible, set the Maximum Visibility distance to inf.

You should specify the same settings for each surface of the same LOD (if any). Different surfaces from one level of details should have the same settings to appear and disappear simultaneously.

Minimum and Maximum Parents#

Another important parameters of the LODs are Min and Max Parents.

These parameters allow you to specify to which surface or node up in the hierarchy the minimum and maximum visibility distances will be measured. Use the default values of 1. In this case, all surfaces of the mesh will be switched simultaneously, because their distances will be measured not to surfaces themselves, but to the bounding box of the whole mesh.

Read here about these parameters.

Last update: 2019-08-16
Build: ()