[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] [ Search: ]

4.9.11 Progressive Level of Detail

Written by Eduardo Poyart, August 2010.

Good management of mesh LODs (levels of detail) is essential for a game engine or any 3D visualizer that works with complex scenes. If a very detailed mesh has to be rendered far away from the viewpoint, it can be replaced with a less detailed version without compromise on the visual quality. This lowers CPU and GPU costs and leads to frame rate improvements and more objects represented on the scene.

With progressive LODs, as models move further away from the camera, their edges progressively collapse one by one, making smooth transitions that produce less visual "pops" than discrete LODs.

This section is about Crystal Space's Progressive LODs support. Currently, Crystal Space supports progressive LODs for genmeshes.

The steps to create a genmesh with progressive LOD support in Crystal Space are described below.

The ‘cslodgen’ tool

The ‘cslodgen’ tool processes a mesh and generates progressive LODs for it. The results can be saved to a new file, which will contain the original mesh and allow LOD representations of it.

The tool works by selecting the best collapse to perform at each collapse step. At the end, it stores information on the mesh that defines the order of collapses. Selecting the best collapse is done by performing many collapses on a copy of the original mesh and using a heuristic to test how much different the collapsed mesh is from the original mesh.

The ‘cslodgen’ tool source is in ‘apps/tools/lod’. You can test it by using sample data in ‘/data/lodtest’ (mounted in VFS in ‘/lev/lodtest’).

This is a typical usage example of the ‘cslodgen’ tool:

lod -i=/lev/lodtest/lodbarrel -mindist=5 -maxdist=50

These are the command line options for the ‘cslodgen’ tool:

lod -i=<input_file> -o=<output_file> -mindist=d -maxdist=d [-em=<fast|precise>]
    [-v] [-force]

-em       Error metric (fast or precise).
-v        Verbose.
-mindist  Minimum LOD distance.
-maxdist  Maximum LOD distance.
          For medium-sized objects, try -mindist=5 -maxdist=50.
          Existing values in input file take precedence, unless -force is used.
-force    Force use of cmdline-specified mindist and maxdist.
          Mindist and maxdist *need* to be either in cmdline or input file.

The ‘cslodview’ tool

The ‘cslodview’ tool allows visualizing and changing LOD levels in order to test the results. Here are the command line parameters:

cslodview <filename> [-m=<num>] -adap

-m=<num>   multiple sprites, large room (will show num^2 sprites)
-adap      adaptive LODs (best if used with -m)

If adaptive LODs are used, the system will try to keep a frame rate close to 30 fps by biasing the LOD levels of the rendered models.

When viewing the model, use the following keys:

The XML LOD tags

The LOD tags reside inside the <params> section of a genmesh factory. The example below shows a typical output file from the ‘cslodgen’ tool.

<meshfact name="...">
    <prog_lod_distances min="5" max="50" />

The lod tool generates everything that you see inside the <lod> ... </lod> tags.

The <prog_lod_distances> tag is generated by the lod tool if it's not already present in the input file. If it exists there, it is preserved. A modeler can set this tag in order to be able to do multiple LOD conversions in one run without the need to specify distances on the command line each time.


The purpose of progressive LODs is to improve the frame rate of your scene without too much compromise on your visual quality. Try to make your models begin to enter LODs (mindist) when they are at a distance that makes them appear relatively small on the screen. The maximum LOD distance (maxdist) should be set to a distance in which the model is tiny on screen. If you look at the lowest-resolution LODs of your model up close, the results will look bad — remember, it was designed to be seen from very far away.

The ‘cslodgen’ tool works on each submesh of the model separately. It can potentially change the bounded volume of your submesh. This means that, if you have a model that has two submeshes touching each other, they will probably not be touching each other anymore at the lowest resolutions. If this is your case and you want to ensure that they touch (or that there are no holes), try to turn them into a single submesh.


A CS application talks with the progressive LOD system through the following interfaces:

Please refer to the API documentation of these interfaces for details.

Examining the ‘cslodview’ source code in ‘apps/tools/lod/lodview.cpp|h’ is a good way to learn the progressive LOD API.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.