The TANE Asset Preview Interface is used to give a quick preview of a single asset from within Trainz Content. To open the interface, right-click on any locally installed asset within Trainz Content and select "Preview Asset".
The asset preview camera camera is controlled by both the mouse and the keyboard. By default the camera will spin around the displayed object. To stop the spinning either click in the 3D view, or press the 'r' key. The camera can be manually rotated/tilted using mouse drag, and zoomed using the mouse wheel.
The following keyboard controls are also supported:
|Up arrow||Tilt camera up|
|Down arrow||Tilt camera down|
|Left arrow||Rotate camera left|
|Right arrow||Rotate camera right|
|W||Move camera forwards|
|A||Move camera left|
|S||Move camera backwards|
|D||Move camera right|
|Q||Move camera down|
|E||Move camera up|
|R||Toggle camera rotation|
|-, Page Down||Zoom camera out|
|+, Page Up||Zoom camera in|
|Home, Spacebar||Reset camera|
|Esc||Close the preview window|
Performance Controls & Statistics
The asset preview window captures a number of statistics which are of use to content creators. These statistics are not gathered every frame but are updated on a regular basis. When analysing these statistics, please keep in mind that these reflect the actual scene being viewed and may be affected by performance settings, scene culling, LOD, and the internal details of the file loaders and renderer. They are not simply a dump of the contents of the files.
The following controls are available to adjust how the asset is displayed in the preview window:
- Preview Mode - Configures how the preview window will display the asset, in order that the user can view different aspects of the asset's construction and performance. See 'Preview Mode' below.
- LOD Level - Allows the standard LOD logic to be overridden and a particular LOD level to be forced. This currently only affects mesh-table LOD. Smaller numbers indicate higher-detail LODs.
- Season - Allows the display season to be customised. Different assets may interpret the season numbers in different ways, and it is asset-specific as to how many season numbers are supported.
The following statistics are currently available:
- Triangle Count - The number of triangles that the GPU is rendering in the current scene. Keeping this number low, especially at lower LOD levels, is an important requirement for performance optimisation.
- Draw Count - The number of draw calls placed with the GPU in order to render the current scene. Keeping this number low is an important requirement for performance optimisation.
- Animation Count - The number of discreet animation effects in the scene. This typically correlates with the number of "*.kin" file instances in use.
- Bone Count - The sum number of bones used by the animations in the scene.
- Mesh Object Count - The number of scenery asset instances in the scene. This includes any sub-instances (ie. attached mesh objects.)
- Attachment Point Count - The number of active attachment points in the scene. This includes explicit attachment points specified in the mesh, implicit attachment points generated by the structure of the asset, and attachment points introduced through other internal mechanisms.
- Renderable Count - The number of renderable objects in the scene. This typically correlates with the number of trainzmesh file or LM.txt file instances in use, however various other runtime objects also generate renderables.
The asset preview window currently offers two display modes.
- Inspect mode displays a single instance of the asset in question (for spline assets, this show a short stretch of spline.) This is useful for understanding how the asset is constructed. The performance statistics give the numbers for the single asset instance.
- Performance Analysis mode displays a large number of instances of the asset in question. This is useful for understanding how the asset behaves in certain real-world scenarios. Mechanisms such as mesh stitching, material sharing and Level of Detail will be in effect and so the efficiency of using the asset repeatedly in a scene can be properly analysed. For example, many costs will not scale linearly with the number of instances in the scene.
In optimal usage, a scene will have one draw call per 30-60k triangles. For the majority of assets, a single instance (as seen in "inspect" mode) will not reach these numbers - although some very heavy assets such as locomotives may do so at top LOD. In "performance analysis" mode, however, you can observe whether bulk usage of the asset trends towards this optimum, or whether costs remain high.
The top LOD is also expected to be relatively expensive in terms of draw calls. This doesn't mean that you should avoid optimising the top LOD, but rather is an acknowledgement that the top LOD tends to prioritise appearance and functionality over performance. As the instance drops in LOD (either via manual LOD control in "inspect" mode, or via "performance analysis" mode) it is important that the triangle count per instance drops off sharply, and the draw call count per instance trends towards 1.
There are a variety of ways that a given asset can induce additional draw calls:
- Each material (or "sub-material" in Autodesk 3ds Max parlance) requires a separate chunk in the model file.
- If a chunk would exceed approximately 65536 vertices, it is split until it is below this limit. Be aware that the vertex count in your modelling software may understate the true number of vertices in the mesh file- certain mesh features may require unique vertices per triangle, resulting in multiple instances of vertices that were shared in the modelling software.
- Meshes are independent of each other. If one mesh would have 3 draw calls, and a second mesh would have 5 draw calls, the result is 8 draw calls.
- Similarly, asset instances are independent of each other. If one asset has 8 draw calls, and the same asset is reused elsewhere in the scene, the result will be 16 draw calls. Mesh stitching and hardware instancing may help reduce this.
Similarly, there are ways that an asset can reduce draw calls at runtime:
- If chunks with a single mesh are considered to use an identical material, they may be merged as long as the chunk maximum vertex count is not exceeded. This is an optimisation to the mesh file loader, and is not related to mesh stitching. This works within a given mesh only, and will not merge between multiple meshes that may comprise a single asset.
- If the asset is a candidate for mesh stitching, each chunk from the source model may be stitched together with other compatible chunks in the scene, reducing the overall draw call count in the scene.
- In some cases where non-stitched assets are used repeatedly in the scene, the engine may use a GPU technology known as "instancing" to substantially reduce the overall draw cost. (TBD: need to explain how this affects the stats.)
Please note that the terms "triangle" and "polygon" are used interchangeably in the Trainz environment. Trainz only supports rendering triangles, so by definition all polygons in the Trainz environment are triangles. If you are using modelling software that works in patches, quads, higher-order polygons, or anything else other than triangle meshes, please be aware that your asset will have been converted to triangles at export time, before it enters the Trainz environment.
Be aware that the triangle count in your modelling software may understate the true number of triangles in the mesh file or at runtime- mesh features such as double-sided geometry may require that two single-sided triangles are sent to the GPU in place of one double-sided triangle in the modelling software.
At higher LODs, it is somewhat meaningless to drop below about 300 triangles per draw call. At lower LODs, especially for stitched objects, it is imperative that the triangle count is dropped as low as possible.