LM.txt file

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
(LM.txt details from CCGTC, with amendments, added)
Line 2: Line 2:
  
  
=Usage=
+
==Usage==
''TBD: What an LM file can do.''
+
''(taken from CCGTC with amendments by PEV)''
  
''TBD: LM vs lod-model''
 
  
 +
'''Level of Detail''' (or 'LOD') is a technique used for asset mesh reduction. Trainz uses a different mesh dependant on the viewing distance. For objects further away a simpler, less detailed mesh is used.
  
=File Format=
+
In the example of the PB15 loco below there are four meshes, the closest being a highly detailed normal mapped model of the loco body, and the farthest being a simple mesh of the shape with the texture and, in this case, with very simple low poly representations of the bogeys. ''(more on this below)'' 
The user-editable *.texture.txt files are ASCII text formatted ''TBD''. Please note that this format is not the same (despite some similarities) as other text-based formats used by Trainz. Please be aware of the filename character restrictions when naming [[LM.txt file]]s and [[IM files]].
+
 
 +
For TS2009, do not have separate textures for each LOD mesh; the same texture can be used for all because textures have their own built-in LOD reduction.
 +
 
 +
 
 +
LM.txt files should be used for rolling stock models.  Other items like scenery (building and trees) using mesh stitching will work better with the lod-model specified in the config.txt.  ''TBD: LM vs lod-model''
 +
 
 +
Assets with LOD reduction must be made with 'indexed meshes' or .im files only (exported from GMax, 3dsMax or Blender). No .pm files are used in LOD.
 +
 
 +
Trainz looks for these .im files through an .lm.txt (LOD mesh file) which is referenced via the asset's config.txt file.
 +
 
 +
 
 +
The following images show the four meshes used for the PB15 loco.
 +
 
 +
Note: Only Figure 4 the hi-res version is bump-mapped.
 +
''Bump mapping will be ignored if the graphics card does not support it.''
 +
 
 +
 
 +
 
 +
'''Figure 1'''
 +
[[Image:Lod1_PB15.jpg]]
 +
PB_15_body_lowest.im (600 polys)
 +
bogey attachments flagged ':Cull',
 +
bogeys represented in mesh ''(see below)''
 +
 
 +
 
 +
'''Figure 2'''
 +
[[Image:Lod2_PB15.jpg]]
 +
PB_15_body_low.im (1947 polys)
 +
 
 +
 
 +
'''Figure 3'''
 +
[[Image:Lod3_PB15.jpg]]
 +
PB_15_body_med.im (5066 polys)
 +
 
 +
 
 +
'''Figure 4'''
 +
[[Image:Lod4_PB15.jpg]]
 +
PB_15_body.im
 +
(10578 polys, and bump-mapped)
 +
 
 +
 
 +
 
 +
 
 +
==File Format==
 +
The user-editable *.lm.txt files are ASCII text formatted . Please note that this format is not the same (despite some similarities) as other text-based formats used by Trainz. Please be aware of the filename character restrictions when naming [[LM.txt file]]s and [[IM files]]. Only English apha-numeric characters (A to Z, a to z, and 0 to 9) plus dash and underscore should be used.
 +
 
 +
 
 +
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, and semi colons in the file data is important, please follow the example.
 +
 
 +
 
 +
 
 +
 
 +
==An LM.TXT Example==
 +
<br>
 +
===LOD Mesh File (PB_15_body.lm.txt) Auran's steam loco:===
 +
version 1.0<br>
 +
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              ''must be included but for internal use only;leave value as 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)''
 +
         
 +
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";
 +
}
 +
     
 +
'''''Note:'''''<br>
 +
'''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 bogey attachment point name in GMax, 3dsMax,  or Blender. (ie "a.bog0:Cull" ).  This can apply to any attachment eg passenger or driver attachments.
 +
 
 +
Where the above applies (bogeys culled) the body mesh will need a low poly representation of the bogeys, as in '''Figure 1''' above
 +
 
 +
Attachment culling cannot be made to work by modifying the config.txt file; you must modify the model's attachment names.
 +
 
 +
 
 +
Keep in mind 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 (if using TRS2004 conventions).
 +
 
 +
 
 +
The LOD Mesh file is referenced from the config.txt file as follows.
 +
 
 +
;Config.txt file extract
 +
 
 +
kuid <KUID:-3:10024>
 +
kuid-table {
 +
            }
 +
obsolete-table {
 +
      }
 +
mesh-table
 +
{
 +
default
 +
{
 +
  mesh PB_15_body/PB_15_body.lm          <---- ''Note the "lm" file extension here''
 +
  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      }
 +
}
  
''TBD''
 
  
  
 
=.txt file extension=
 
=.txt file extension=
 
[[LM.txt file]]s have a ".LM.txt" name extension, however when a model file is specified within a [[config.txt file]] or similar, the ".txt" must be omitted, leaving the ".LM" extension. For example, a model file named ''box.LM.txt'' is specified in a [[KIND Traincar]] config file using the syntax ''mesh "box.lm"''.  
 
[[LM.txt file]]s have a ".LM.txt" name extension, however when a model file is specified within a [[config.txt file]] or similar, the ".txt" must be omitted, leaving the ".LM" extension. For example, a model file named ''box.LM.txt'' is specified in a [[KIND Traincar]] config file using the syntax ''mesh "box.lm"''.  
 +
 +
''TBD: LM vs lod-model''
  
 
[[Category: File formats]]
 
[[Category: File formats]]

Revision as of 21:04, 8 February 2010

LM.txt files are ASCII text format files describing a single model with multiple levels of detail. LM.txt files have a ".LM.txt" name extension, however when a LM.txt file is specified within a Config.txt file or similar, the ".txt" must be omitted, leaving the ".LM" extension.


Contents

Usage

(taken from CCGTC with amendments by PEV)


Level of Detail (or 'LOD') is a technique used for asset mesh reduction. Trainz uses a different mesh dependant on the viewing distance. For objects further away a simpler, less detailed mesh is used.

In the example of the PB15 loco below there are four meshes, the closest being a highly detailed normal mapped model of the loco body, and the farthest being a simple mesh of the shape with the texture and, in this case, with very simple low poly representations of the bogeys. (more on this below)

For TS2009, do not have separate textures for each LOD mesh; the same texture can be used for all because textures have their own built-in LOD reduction.


LM.txt files should be used for rolling stock models. Other items like scenery (building and trees) using mesh stitching will work better with the lod-model specified in the config.txt. TBD: LM vs lod-model

Assets with LOD reduction must be made with 'indexed meshes' or .im files only (exported from GMax, 3dsMax or Blender). No .pm files are used in LOD.

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


The following images show the four meshes used for the PB15 loco.

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


Figure 1 Lod1 PB15.jpg PB_15_body_lowest.im (600 polys) bogey attachments flagged ':Cull', bogeys represented in mesh (see below)


Figure 2 Lod2 PB15.jpg PB_15_body_low.im (1947 polys)


Figure 3 Lod3 PB15.jpg PB_15_body_med.im (5066 polys)


Figure 4 Lod4 PB15.jpg PB_15_body.im (10578 polys, and bump-mapped)



File Format

The user-editable *.lm.txt files are ASCII text formatted . Please note that this format is not the same (despite some similarities) as other text-based formats used by Trainz. Please be aware of the filename character restrictions when naming LM.txt files and IM files. Only English apha-numeric characters (A to Z, a to z, and 0 to 9) plus dash and underscore should be used.


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, and semi colons in the file data is important, please follow the example.



An LM.TXT Example


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              must be included but for internal use only;leave value as 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)
          
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";
}
      

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 bogey attachment point name in GMax, 3dsMax, or Blender. (ie "a.bog0:Cull" ). This can apply to any attachment eg passenger or driver attachments.

Where the above applies (bogeys culled) the body mesh will need a low poly representation of the bogeys, as in Figure 1 above

Attachment culling cannot be made to work by modifying the config.txt file; you must modify the model's attachment names.


Keep in mind 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 (if using TRS2004 conventions).


The LOD Mesh file is referenced from the config.txt file as follows.

Config.txt file extract
kuid <KUID:-3:10024>
kuid-table {
            }
obsolete-table {
      }
mesh-table
{
default
{
  mesh PB_15_body/PB_15_body.lm          <---- Note the "lm" file extension here
  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       }
}


.txt file extension

LM.txt files have a ".LM.txt" name extension, however when a model file is specified within a config.txt file or similar, the ".txt" must be omitted, leaving the ".LM" extension. For example, a model file named box.LM.txt is specified in a KIND Traincar config file using the syntax mesh "box.lm".

TBD: LM vs lod-model

Personal tools