Trainz Mesh Importer

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
 
Line 1: Line 1:
 +
 +
''Please note that this document is obsolete as of trainz-build 4.5. Trainz now imports from the [[FBX file format]], which is widely enough used to serve as a generic interchange format. The Windows-only Trainz Mesh Importer utility is no longer supported.''
 +
 +
 
The Trainz Mesh Importer tool is Auran's supported path for importing 3D models and animation from sources other than Autodesk 3DS Max. The tool is not directly useful to content creators- instead it is a building block that third-party programmers may use to safely build .im and .kin binary files.
 
The Trainz Mesh Importer tool is Auran's supported path for importing 3D models and animation from sources other than Autodesk 3DS Max. The tool is not directly useful to content creators- instead it is a building block that third-party programmers may use to safely build .im and .kin binary files.
  

Latest revision as of 11:30, 7 November 2016

Please note that this document is obsolete as of trainz-build 4.5. Trainz now imports from the FBX file format, which is widely enough used to serve as a generic interchange format. The Windows-only Trainz Mesh Importer utility is no longer supported.


The Trainz Mesh Importer tool is Auran's supported path for importing 3D models and animation from sources other than Autodesk 3DS Max. The tool is not directly useful to content creators- instead it is a building block that third-party programmers may use to safely build .im and .kin binary files.

Third-party utilities which attempt to directly read or write .im and .kin format are not supported by Auran, and it is recommended that content creators do not use these utilities as there is a risk that the content may crash Trainz or fail to work with future Trainz releases.

To enable third-party exporters in a supported fashion, Auran has developed the Trainz Mesh Importer which converts from an open xml-based file format to the proprietary .im and .kin file formats.

The Trainz Mesh Importer is available on the Downloads page.

To give an idea what the import format looks like, here is a minimal valid import .XML file. Note that this example exists purely to demonstrate style and simplicity. Real usage should include more information. The complete file specification is documented in the download package.

 <trainzImport>
   <version>1</version>
 
   <mesh>                                
     <name>m.tiny</name>
     <triangles>
       <triangle>
         <materialId>0</materialId>
         <vertex>
           <position>0,0,2</position>
           <texcoord>0,0</texcoord>
         </vertex>
         <vertex>
           <position>10,0,2</position>
           <texcoord>1,0</texcoord>
         </vertex>
         <vertex>
           <position>10,10,2</position>
           <texcoord>1,1</texcoord>
         </vertex>
       </triangle>
     </triangles>
   </mesh>
 
   <materials>
     <material>
       <name>BrickWall</name>
       <id>0</id>
       <diffuse>1,1,1</diffuse>
        <textures>
         <texture>
           <textureName>c:/textures/brick.tga</textureName>
           <typeName>diffuse</typeName>
         </texture>
       </textures>        
     </material>
   </materials>
 
 </trainzImport>

To process this file, the command line could be as simple as:

 TrainzMeshImporter -inFile "c:/import/testtiny.xml"

The full format supports attachments, animations, events and more complex models and materials than what is demonstrated here.

Personal tools