Automatic Switches

As part of upgrading the visuals of the train, here’s a new model with new materials for automatic switches of the train. These switches take role of circuitbreakers – they protect various parts of control circuits of the trains against excessive currents. There are approximately ~72 of them in a 81-717 train.

These switches have three states (off, on, tripped). In many cases, disabling part of the train control circuitry may help when diagnosing or eliminating a problem that would otherwise leave the train stopped. There were also cases when drivers have made very considerable mistakes due to an otherwise minor failure – while simply switching off the electric circuit would’ve eliminated the issue.

av1

There’s nothing significantly unusual about the switch rendering, it is well covered by the existing material system mechanisms, with one exception. The older switches have their chassis made of a proto-plastic material (bakelite), giving them an interesting visual polycrystallic pattern. This effect could be replicated by a clever texture, but to permit re-use of the same bakelite material and to create a variety of switches, instead they are textured by bi-color tinting.

av2

The existing material system permits tinting any material or texture with an arbitrary color (it simply multiplies the source color by the target color). Bi-color tinting will tint the texture the same way, but one of two colors will be selected based on the red channel of the source color. In other words:

one_color_tint = source_color * tint_color;
two_color_tint = source_color * lerp(tint_color1, tint_color2, source_color.r);

For the bakelite material, a special texture is used as an input to tinting. This texture is not actually multiplied with the tinted color – the material permits substituting white (to a variable extent) instead of the actual source. This is used to modify brightness ‘depth’ and create a variety of materials based off the same source textures.

av3

The texture itself is nothing more than perlin noise with correct scaling and a threshold filter pre-applied to it.

An overwhelming portion of materials in Subtransit are based off a single base material with a lot of static switches and other means to toggle various features on and off. The material itself is built out of re-usable base blocks (material functions in UE4 terms). I will go more in-depth about the base/master material in a later post, but as an illustration, here is the block which adjusts colors of the source texture:
av4

And here is the position of this block within the multi-layered base material:
av5

Even materials which do not derive from base material automatically get new features, since all of them are based on same basic building blocks. Of course, all changes are backwards compatible. In the extreme cases when a material may rely on some heavily obsolete feature it is simply switched to a snapshot of master material before the obsolete feature was modified or removed.