CCG/Modelling: Level of Detail Mesh Reduction

From TrainzOnline
< CCG
Revision as of 13:27, 15 June 2011 by Pev (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

LEVEL OF DETAIL MESH REDUCTION

General Description

Level of Detail (or `LOD') is a technique used for asset mesh reduction. Trainz uses a different mesh dependant on the viewing distance.

This concept is different from the previous "progressive mesh" (.pm) reduction as used by UTC. That is, instead of gradually reducing the polycount of a single mesh you can now have several versions of the same asset, each at different polycounts and texture levels. (See `Directory Structure', next page)

Assets with LOD reduction must comprise of `indexed meshes' or .im files only (exported from gmax or 3dsmax). No .pm files are used in LOD.


TRS2004 looks for these .im files through an .lm.txt (LOD mesh file) which is referenced via the asset's config.txt file.

Note: Only Figure 4 the hi-res version is bump-mapped. Bump mapping will be ignored if the graphics card does not support it.

Use only non-formated text to create the .lm.txt file i.e.

Use a simple text editor such as notepad

The use of upper and lower case letters in the tag names are important, please follow the example. Refer to the .lm file in the next column for information.

LOD Mesh File (PB_15_body.lm.txt) Auran's steam loco:

version 1.0 offset = 0.01 calcpoint =center multiplier = 1.0; animationCutOff = 0.00; renderCutOff = 0.00; attachmentCutOff = 0.06; mesh("0.07") {

 name="PB_15_body_lowest.im";    

} mesh("0.30") {

 name="PB_15_body_low.im";

} mesh("0.52") {

 name="PB_15_body_med.im";

} mesh("1.0") {

 name="PB_15_body.im";

}

Breakdown of LOD Mesh File

Version 1.0 offset = 0.01; The offset that prevents "popping" between two levels of of detail repeatedly

calcPoint = center; The position where the level of detail is calculated from (center,near,far)

PB_15_body_lowest.im (600 polys, 64x64 tex) bogies PB_15_body_low.im (1947 polys 256x256 tex)

     attachments flagged `:Cull',
     bogies represented in mesh (see next page)
     Figure 1				Figure 2

PB_15_body.im

  PB_15_body_med.im (5066 polys 512x256 tex)	(10578 polys, 1024x512 tex and bump-mapped)
    Figure 3				Figure 4


multiplier = 1.0 A level of detail multiplier (leave as 1.0)

animationCutOff = 0.0 The level of detail where animation stops (to screen width) 1.00 = full width, 0.5 = half screen, 0.00 = never stop animation

renderCutOff = 0.0 The level (to screen width) where rendering stops (no longer visible)

attachmentCutOff = 0.06 The level where Cull flagged attachments are dropped (to screen width) *See note below

Note: Meshes are referenced within a LOD file must be in ascending width order.

mesh(“0.07”) {

  name=”PB_15_body_lowest.im”

}














When the mesh is displayed at 0.07 of the screen, the mesh “PB_15_body_lowest.im” is displayed. Note the figure is just bigger than the attachment cut off figure above. This ensures the modeled bogeys in this LOD mesh are rendered before the actual bogeys are culled.

mesh(“0.30”) { name =”PB_15_body_low.im” }

mesh “PB_15_body_low.im” is displayed when the mesh is at 0.3 of screen width.

mesh(“0.52”) { name = “PB_15_body_med.im” }

mesh(“1.0”) { name = “PB_15_body.im” }

Config.txt file extract


kuid <KUID:-3:10024> kuid-table {

            }

obsolete-table {

      }

mesh-table { default {

 mesh PB_15_body/PB_15_body.lm
 auto-create 1

} shadow {

 mesh PB_15_shadow/PB_15_shadow.im

} reverser {

  mesh PB_15_body/reverser/reverser.im
  anim PB_15_body/reverser/reverser.kin
  auto-create 1
  att a.bog2
  att-parent default       }

}


















Directory Structure (LOD Loco)

The main thing to remember is that all LOD files, .im meshes and textures must be located within the same directory. In the case of a locomotive or rolling stock item, it should be in the *_body directory. Note the LOD Mesh file is referenced from the config.txt file.




Note attachmentCutOff = 0.1; Attachment cutoff specifies the level where attachments with the flag ":Cull" are dropped.

ie To stop drawing the bogeys of the trains at a specific level of detail, append :Cull to the bogie attachment point. (ie "a.bog0:Cull" )

Where the above applies (bogeys culled) the body mesh will need a low poly representation of the bogeys.

Personal tools