Modeling Trains for Trainz

From TrainzOnline
Jump to: navigation, search

- General Information for Artists

Contents

Introduction

As Trainz has advanced over the years it's features have been constantly expanded and refined. While the trains seen in the game were once reasonably simple in terms of geometry, resolution, lighting and configuration; today they are much more complex and their setup requires greater consideration.

Following is a TRS2009 outline of the fundamental technical and style recommendations for modeling Trainz locomotives and rolling stock. The export process will be covered separately.

It's recommended that geometry is created in 3DS MAX which is supported by the Trainz exporter, or Blender. Note that GMax is not supported.

Unit Scale

Under Customize/Units Setup...

MTFT-IIPA Units.jpg

System Unit Scale must be set to 1 metre. Display Unit scale may be set to Metric or US Standard but not generic units.

Material Format

Textures are 32-bit tga format unless otherwise specified and dimensions should be powers of 2 i.e. 128, 256, 512, 1024, 2048. All texture pages are ideally contained in a single Multi/Sub-Object material...

MTFT-IIPA Multi-Sub-Object.jpg

Opaque Materials

Opaque textures are configured as environment reflective, normal mapped materials. The required naming convention for these materials is "materialname.m.tbumpenv". Specular level is controlled per pixel in the specular map and isn't affected by the settings under Specular Highlights. Environment reflection is also controlled per pixel and so no map is required in the Reflection slot. Only the Diffuse Color and Bump slots should contain maps in the final model; other types are not supported by the game engine or not appropriate for this shader. Also ensure that 2-sided is not selected under Shader Basic Parameters.

MTFT-IIPA tbumpenv.jpg

Opaque Material Components

MTFT-IIPA diffuse.jpg

Diffuse Map - Two 2048x2048 32-bit tga files may be used for a locomotive; for carriages one is usually enough unless the interior requires a lot of detail.

MTFT-IIPA reflection.jpg

Reflection Map - Realtime reflection is controlled in the alpha channel of the diffuse map. Black results in no reflection, best for dull details. Dark gray e.g. RGB 30,30,30 results in subtle reflection, good for painted metal surfaces.

MTFT-IIPA normal.jpg

Normal Map - Up to two 2048x2048 32-bit tga

MTFT-IIPA specular.jpg

Specular Map - Specular level is controlled per pixel in the alpha channel of the normal map.

As the game engine provides only basic shadow and ambient occlusion effects, a more convincing result is achieved with some lighting "burnt in" to the textures. There are some considerations however since the models can be viewed from any angle and at different times of day or night. Strong directionality in textured sunlight or shadow detail should be avoided. Lighting as though from directly above is generally necessary for an effective result in game.

MTFT-IIPA lighting.jpg

Semi Opaque Materials

The configuration pictured below is an effective setup for representing windows. Alpha blending is set using the Opacity spinner rather than by alpha channel. This type of material doesn't use per pixel control over specular level which is set under Specular Highlights. Diffuse map is a 128x128 24-bit tga, and a default realtime reflection map (env_metal.bmp) has been applied using the reflection slot. The correct naming convention for this material is "materialname.m.reflect".

Alpha blending is a poor performer and should only be used for windows or other semi transparent surfaces.

MTFT-IIPA window.jpg

Locomotive Components

Train cars are comprised of a group of separate models which are combined in the game as required...

MTFT-IIPA loco.jpg

Body - This encompasses anything that's not animated, including a basic view of the interior through the cab windows.

MTFT-IIPA bogies.jpg

Bogie - A wheelset or "bogie" must be a separate model i.e. it is not attached to the main mesh, and it must use it's own texture.

MTFT-IIPA locoshadow.jpg

Shadow - Body and Bogie shadows are separate, low poly models (max 1k). They should be "watertight", be able to fit inside the parent object, and follow the geometry of the exterior as closely as possible. Shadows pictured here display an entry level requirement, though were created before improvements were made to the game engine allowing for greater shadow detail.

MTFT-IIPA fans.jpg

Fans - Any visible fans should be left as separate objects to allow for animation. They may share the locomotive body material.

MTFT-IIPA locohoses.jpg

Couplers and Hoses - If these are to be scripted using ACS Coupling System then they should be separate objects, though they may all share one small separate texture, they should not use the main loco texture as they'll be exported as separate assets.

MTFT-IIPA locinterior.jpg

Interior View - This is a separate hi resolution model of the view from inside the cab showing only the parts of the loco that are visible from inside.

Modeling Locomotives

The sum of the locomotive exterior including all bogies, hoses and fans etc may be up to 120k polygons with four LOD levels provided. It's ideal to aim for a reduction of up to half at each level, though this may not always be possible.

It's recommended that any painted numbers should not be represented in the any of the textures. Similarly any numberboards should be modeled but should be left blank, and the 'alphanumbers' system employed so that numbers can be selected by the end user.

When modeling the bogie for a diesel/electric loco a 1024x1024 tga is sufficient. On occasion the front bogie is different to the rear in which case another seperate model and texture is required. Wheels should be left as seperate objects rather than attached to the bogie because they'll be animated during export, though wheels may share the main bogie texture.

Shadows are textured with a 32x32 24-bit tga named "black.tga" this is replaced with a builtin texture at runtime. In the current version of the game, train cars are self shadowing so keeping in mind the 1k limitation, a reasonably detailed shadow is the modern pre-requsite. While the shadow model itself is not seen in game, the shadow geometry must be slightly smaller in size than the main model. If the two models are combined the shadow should disappear inside the main model.

Modeling Interior Views

The interior view may use up to two 2048x2048 textures and be of up to 50k polygons. Handles, needles, levers etc should all be placed in situ but left as separate objects to allow for animation. All of these objects may share the main interior material.

From: HowTo: Build A Cab Interior

Basic Structure

The basic structure of a cab is quite similar to a number of different assets. You will have a main mesh with a number of attached sub-meshes, which are arranged using a mesh-table.

The main cab mesh typically consists of the interior walls, roof and floor of the cab, the control desk or stand, all furniture or other static objects visible inside the cab, and also all parts of the locomotive exterior that are visible from inside the cab - e.g. the top of any projecting nose below the cab windows. Remember to consider the sightlines out of rear windows too for visible bodywork panels - the user can move around the cab and rotate the camera to any angle. Users are not restricted to looking forward out of the front windows only.

Artwork considerations

There are some differences in style between the construction of an interior object and a typical trainz object.

Except in very specific circumstances, there will not be more than one interior object in existence at any time, and that interior is always viewed from very close range - the user is inside it. Because of this, interiors are typically modelled with a high polygon count and with high resolution textures, to give an impressive visual feel. LOD is not used, as the user never gets far enough away from the interior for LOD techniques to have worthwhile benefit.

Trainz lights interior objects differently to map objects like buildings and other scenery - the main illumination is ambient, not directional. (A steam loco does have a directional light coming from the firebox, but a diesel or electric cab typically has no directional light inside, and relies entirely on ambient illumination).

With ambient illumination, effects such as normal and specular mapping do not have much (if any) effect. Because of this, more effort needs to be put into the diffuse texture for a cab interior than would normally be applied to Trainz objects. Drawing or baking shadows and other effects into the diffuse textures is required to produce a nice looking cab interior.

Coach Components

Like locomotives, coaches are comprised of a group of separate models which are combined in the game as required, though there are some differences.

MTFT-IIPA coach.jpg

Body - As there are so many large windows the representation of the interior needs to be reasonably detailed.

MTFT-IIPA coachbogies.jpg

Bogie - The bogie again must be a separate model i.e. it is not attached to the main mesh, and it must use it's own texture.

MTFT-IIPA coachshadow.jpg

Shadow - Separate body and bogie shadows.

MTFT-IIPA doors.jpg

Doors - These should be modeled in situ but remain separate from the main body mesh so they can be animated during export. They may share the coach body material.

MTFT-IIPA coachhoses.jpg

Couplers and Hoses - If these are to be scripted using the ACS Coupling System then they should be separate objects, they may all share one small separate texture, they should not use the main coach texture. Often but not always they are the same hoses as found on the locomotive.

MTFT-IIPA coachinterior.jpg

Interior View - High detail model of the view from inside the coach.

Modeling Coaches

As many coaches may be on screen at a time they are required to be less taxing on system resources. Wherever possible exterior detail is textured on, this is generally not possible with objects such as the seating and card tables of the interior. Depending on the interior detail, coaches should be under 30k polygons with four LOD levels, though most coach types can be adequately represented at well under that.

A 2048x2048 texture can be used for the coach exterior.A Small 128x128 texture can be used for windows.

As there is plenty of texture resolution available for the interior details as seen through the window; and as long as there is sufficient polygonal detail, an Interior or 'passenger' view can be sourced directly from the top LOD of the coach geometry.

See [#locointerior Modeling Interior Views]

Level Of Detail

From: Modeling Guidelines

Level-Of-Detail (LOD) is a rendering term for swapping between various 'detail levels' as an object changes viewing distance. Close objects are rendered in high detail, whereas far objects use a lower detail variant. Each LOD should look identical, with the exception of the performance vs quality trade-off. It is important that the overall coloring (including apparent coloring that stems from the lighting model) and silhouette of the object are preserved, since changes to these are the most visible to an observer. Changes to the fine details within the object are far less noticeable.

As an object moves away from the observer, each doubling of the distance results in a halving of both the horizontal and vertical size of the object in screen space. Roughly speaking, this means that we can afford to lose 75% of the object detail at each double distance. In practice, it can be hard to lose that much detail without compromising the silhouette, so a slightly more gradual approach is recommended. If an object is at full detail at 10m, consider halving the detail at 30m, and again at 100m. By the time you reach 1000m, you need to have shed the vast majority of the detail and be left with a reasonably low poly object.

LOD operates for both the textures and the models.

Texture LOD

Trainz will take care of performing texture LOD by falling back to lower mip levels as the object moves into the distance. The unused higher mip levels will be unloaded as necessary, to reduce the game's memory footprint. When the object approaches the observer, the higher mip levels will be reloaded. When several of the same object are in the scene, the game will load up to the highest mip level currently necessary for any of the objects, but the GPU will still perform texture LOD per object.

Personal tools