logo
Taal/language:uk flagnl flag

DTG Train Simulator Tech Article : Level Of Detail (LOD)

Level of detail is a technique used in realtime computer graphics in everything from commercial flight simulators right down to PC and console games. 3D games running on a graphics card have a finite ability to draw surfaces (polygons and triangles) and textures. When you exceed that limit, the game or simulation begins to slow down and become jerky. For example if a game runs at 60Hz, the graphics engine has to assemble and draw the scene in 1/60th of a second. If you ask the graphics engine to do too much, it takes longer than that, and the framerate goes down. You see this as the game or simulation suddenly having jerky movements and slower update rates.

The difference between polygons and triangles

Every graphics engine renders 3D scenes made up of triangles. As a modeler you may create something with many more sides, but by the time the game or simulation sees it, the surface will have been decomposed into triangles.

Why does level of detail help?

In the distance, the wheels do not need as many triangles in them (right)

Creating 3D models with level of detail (LOD) can help because as the content designer, you can eliminate detail from the scene when it becomes too small to be seen, or unimportant to what is being displayed. This allows the graphics engine to concentrate on using higher numbers of polygons or triangles for items closer to the eyepoint. In the picture here you can see an example of some train wheels. The higher level of detail on the left has considerably more triangles in it than the lower level of detail on the right. Yet in the distance, the player would not be able to perceive a difference once the object becomes quite small in the scene.

Level of detail in Train Simulator

The Train Simulator model tools and compilers use simple naming conventions and object hierarchy to create level of detail in the final scene. The rule is this: lower levels of detail must be children of the higher levels of detail.
The naming convention is also important. The object name can be broken down into three pieces. Important: the numerical range in meters must have four (4) digits:

Examples

Consider the following picture:

Here we have two examples. The simple example on the right - 1_0032_smallparts is an object that simply comes on when the camera is closer than 32m to the object.
The more complex example on the left shows an object that has two levels of detail. For Train Simulator to know that these represent the same physical item in the scene, the object name must be the same for each level of detail (in this case wh01). The lower level of detail (2_2000_wh01 with less triangles) is a child of the higher level of detail (1_0100_wh01). Beyond 2000m away, neither object will be drawn. As the camera gets to 2000m, 2_2000_wh01 will be drawn. Once the camera gets to 100m away, 2_2000_wh01 is turned off and replaced with 1_0100_wh01. ie. as the camera gets closer, the low level of detail object is replaced with the high level of detail object.
Train Simulator is not limited to two levels of detail. There could be a third object below those two called 3_2500_wh01 that would be displayed from 2500m to 2000m away.
Note that the level of detail number (the first digit) goes up with each child. So 1_0100_wh01, then 2_2000_wh01.