Advanced LOD Techniques

From TrainzOnline
Jump to: navigation, search

This page details a number of LOD techniques which are not in themselves new capabilities, but rather which make inventive use of existing capabilities.

Texture Atlas at low LOD

Using a texture atlas can be a great way to make a scene more efficient. Many related (ie. frequently used together) assets can be combined into a mesh library and use material sharing to qualify for mesh stitching. For some assets, this approach might seem unworkable at first because the object requires too much detail (either texture detail or mesh detail) up close. With too much texture detail, it would be impossible to fit a large number of assets into the texture atlas. With too much mesh detail, mesh stitching would be disabled.

Such assets can still participate in the benefits of a texture atlas by using mesh-table LOD with their higher LODs using unique materials and high-detail meshes, with the lower LODs using the texture atlas and low-detail meshes. The high-detail meshes won't participate in mesh stitching, but there won't be many of them on the screen anyway. The low-detail meshes, of which there are likely to be quite a lot in the scene, will benefit from the more efficient approach.


Use of mesh-table LOD with LM.txt

Mesh-table LOD is an entirely separate concept from the self-contained LOD present in LM.txt files. You should not attempt to configure the LM.txt transition distances using the "mesh-table-lod-transition-distances" tag. It is, however, possible to combine the effects.

Consider the following LOD structure:

  • Mesh-table LOD 0
    • LM.txt LOD 0
    • LM.txt LOD 1
    • LM.txt LOD 2
  • Mesh-table LOD 1
    • IM
  • Mesh-table LOD 2
    • IM

In this scenario, you effectively offer 5 LOD levels. There are 3 mesh-table LOD entries, but the top LOD is itself an LM.txt file with additional "sub-LODs".

Using this approach allows you to use features that are exclusive to the LM.txt file format, such as attachment point LOD control and animation shared across LOD levels, while benefiting from the efficiencies of mesh-table LOD (such as fully-disabled animation and suitability for mesh stitching) at lower detail levels.

Since the mesh-table LOD is independent of and takes precedence over the LM.txt file LOD, you must ensure that the LOD distances between the two systems are appropriately configured to show each of the LM.txt file LOD meshes before switching to the next mesh-table LOD. If you get this wrong, you may find that the next mesh-table LOD kicks in before the LM mesh has reached low detail.


Lodandlm.jpg


To explain the above image even further. The mesh-table-lod-transition-distances tag is set to the following lod transitions: Mesh-table container “lod0-lm” will show from 0 – 1500 meters and the LM.txt file lod transitions will automatically swap in and out automatically between that range based on how the .LM lod functionality works:

   mesh("0.15")
   {
       name="body_lod4.trainzmesh";
   }
   mesh("0.4")
   {
       name="body_lod3.trainzmesh";
   }
   mesh("0.95")
   {
       name="body_lod2.trainzmesh";
   }
   mesh("1.0")
   {
       name="body.trainzmesh";
   }

Mesh-table container “lod1” will show from 1500 meters to 2000 meters.

From 2000 meters and beyond no meshes will be rendered.

Personal tools