Go to Gallery           Register for MyTrainz | Login to MyTrainz

Behind the Scenes (and behind the scenery)

By Tony_Hilliam, September 08 2017

Over 15 years ago, when Trainz was first released, a desktop computer was far less powerful than the phone sitting in your pocket right now. As computational power has increased, rendering techniques have changed dramatically. This blog looks at the techniques used in the original Trainz through to the what is coming up in the next version of Trainz we're working on right now.

Trainz V1.0 - no shaders, per-vertex lighting

The original version of Trainz was built with the latest 3D rendering techniques at the time. This meant per-vertex fixed-function lighting. GPUs of the era did not support shader programming, so there were few options when it came to how textures were affected by the game's lighting environment. This resulted in a flat looking scene with no real options to tweak the look of the materials.

TRS2004 - simple shaders, per-vertex lighting

With TRS2004, we introduced our first fragment shaders which were simple normal maps. The GPUs were still extremely limited by modern standards, but these simple shaders brought a little more control over how an object would be lit in a scene.

We made a number of small improvements and additions to the shaders over time, but it was 10 years before we took the next real big steps.

T:ANE - Per-pixel Rendering and Post-Processing

Trainz A New Era introduced a whole new rendering engine based upon per-pixel rendering, resulting in much smoother lighting. By this time, much of the Trainz content supported normal maps and per-pixel specular highlights (shiny surfaces).

TANE also introduced HDR and Post-Process effects such as tone-mapping, depth-of-field, bloom, screen-space ambient occlusion, and sun rays.

The underlying lighting and material equations were still derived from the original fixed-function lighting, albeit with a much higher-quality result.

 

Coming "Soon" - Physically-Based Rendering (PBR)

While we're not ready to announce details on the timing for the next Trainz release just yet, we can announce that we will be adopting Physically-Based Rendering (PBR) techniques.  

This approach is widespread in modern rendering workflows, originally derived from cinematic rendering and now becoming common throughout the gaming industry. It brings a substantial rethink of the material lighting equations, unlocking some much improved visual results.

As with anything being simulated by a computer, it's still an approximation of real-world physics. However, unlike the old fixed-function approach, the approximation is much more accurate and the results tend toward more realistic looking outcomes. 

(Click on the images to enlarge)

Themes such as "conservation of energy" and "color space correction" feature heavily. 

For TRS2018 we are adopting a Metal / Roughness Workflow. This name refers to the texture inputs used in this workflow to provide the physical parameters required for the lighting equations.

It's not the only possible PBR implementation, but it's a common approach in the gaming industry so content creators will find plenty of documentation online describing the principles.

The short version for PBR is that instead of "Red, Green, Blue", "Specular Strength" and perhaps "Reflection Amount", each texel has the following input parameters:

  • Albedo (red, green, blue)
  • Metallicity (is this location on the material a dielectric surface, a metallic surface, or some hybrid?)
  • Roughness (is this location on the material smooth and shiny or rough and matte?)
  • Ambient Occlusion (is this location on the material exposed to ambient lighting, or is it hidden away where only a directional light will reach?)
  • Emissive (does this location on the material glow with an inner light?)

The new lighting equations are responsible for consuming this information and any scene inputs (lighting, etc) and producing a physically-correct output.

The equations are color-space aware: the albedo and output are in SRGB color space while all calculations are performed in the correct linear color space.

Impact on Existing Content

While our new PBR materials provide a host of new capabilities for content creators, we also need to ensure that existing assets don't look out-of-place. With hundreds of thousands of assets out there, we don't want everything to be rebuilt from scratch.

Thankfully, it's possible for us to automatically retrofit the PBR techniques to existing assets as the comparison below shows (this was a case of simply dropping the loco into the new version of Trainz).

TANE SP2 above and the new PBR technique below (same loco in both shots)

Detailed Explanation and Examples

Youtube provides a lot of detail on these techniques, and we've picked a couple of videos to give you more of an idea about PBR.

Video 1: Materials showcase

Video 2: Detailed explanation for artists

Stay tuned to Trainzportal News and Blogs for more information on other changes and improvements coming to Trainz.