Lighting

The methods available for lighting have changed with successive versions of the Studio.

_LS Objects

Up to version 5An LS object is an object named with an _LS prefix. An LS object is interpreted as a light source. Objects named this way are assigned a material that always lights up, even at night. Is no longer supported from v6, as the emissive property of the PBR materials can be used instead.

_LC Objects

Up to version 7An LC object is an object named with an _LC prefix. For example: “_LC_Window”. _LC used as an object name suffix won’t work.

An LC object is interpreted as a light cone. These have the additional properties that their texture is formed using the additive method which enables brightness gradients. If an LC object does not have a texture, it is given a standard texture that resembles a cone of light.

Vehicles automatically show or hide LC objects depending on the simulation time. LC Objects without a texture are not lit and are transparent in daylight if alpha is set to 0, but are lit at night.

Non-vehicles, such as buildings, are lit all the time. Often this doesn’t look right in daytime.

The light is only faint. There is no adjustment of light intensity.

Night view of vehicles with _LC objects as windows

LC objects don’t work in models which have been setup as splines.

LC objects are described in the documentation for v7 but not in the documentation for v8. The changelog does not say LC objects have been dropped, and they still work in v8, so the omission from the documentation may be unintended. However, it seems likely they are being phased out in favour of the use of emissive objects, see section 4 below.

Setting a value for Emissive in Blender

From version 7Objects can use an emissive texture in Blender.

Emissive window lights in daytime. Emissive strength set to 0.5.

Lit objects in daylight don’t look right. It would be possible to set up an animation to control the light, but this will be tedious for a typical layout having many lights. Here is some example code to turn a light on or off:

 if my_lights == nil then
    my_lights = false
 end
 if layout.time < toTime("06:00") or layout.time > toTime("18:00") and not my_light then
    $("lamp-1").animations["light-on"]:play(-1, 1)
    <-- other lights here
    my_lights = true
 else
    $("lamp-1").animations["light-on"]:play(-1, -1)
    <-- other lights here
    my_lights = false
 end
The same view showing emissive window lights at night time.

Objects which may be lit or unlit need another material slot. For compliance with Studio standards, the maximum level of detail is limited to 5 materials for vehicles and 3 for models. For the least level of detail, materials are limited to 3. This may be a restriction in models which use several textures.

Emissive Textures

Up to version 8The Studio provides a method to set daytime and night time textures. Two texture files are needed but animations or coding are not required. The two texture files count as one when complying with model standards.

Credit to user BahnLand for the following explanation:

The only light source that can cast shadows is the daylight which is built into the Studio. There are no other light sources in the Studio that can radiate light and shine it onto objects. Importing a light source model from Blender doesn’t work.

To simulate lighting, two textures are needed. For example, if the first is called “palette.png”, then the second would have the same name but with the suffix “_Emissive”, so it would be called: “palette_Emissive.png”.

The emissive texture is essentially a copy of the original texture, with some of the surfaces blackened. Those areas of the texture that are used in the original texture to paint the model surfaces that are supposed to glow at night remain in the emissive texture. All other parts of the emissive texture are blackened.

If the model painted with the original texture is uploaded and the Studio recognizes the associated emissive texture and uploads it, it uses both textures together when displaying the model. The colours of the original texture are darkened according to the ambient brightness, dusk or night, while the colours of the emissive texture are always displayed at full strength and therefore glow at night.

During the day, “double-painting” the model faces that are supposed to glow at night may lead to “overexposure” because adding the colors of both textures together results in a lighter shade than if only one of the two textures were in effect. To avoid this, after finishing texturing the model, replace the original texture with a copy that blackens exactly those surfaces that are not blackened in the emissive texture. This means that only one of the two textures is in effect on each textured surface of the model, and overexposure during the day is eliminated.

It is important to retain the original texture without any blackening. This is because if the model is subsequently retextured, the original texture is required for the new colouring of the areas to be illuminated, which must also include any “luminous motifs”,

The following method is recommended for texturing and using textures for illuminated surfaces:

  1. Use full original texture to texture the model.
  2. Create an emissive texture as a copy of the original texture and keep only those areas that are used for the glowing surfaces of the model. All other areas of the emissive texture are blackened. The name of the emissive texture differs from that of the original texture by the suffix “_Emissive” at the end of the file name but before the extension.
  3. If the possibility of overexposure when displaying the model in daylight is acceptable, the model with both textures can be uploaded to the Studio.
  4. Otherwise, make a backup copy of the original texture, which is used for any future changes to texturing the model, and blacken those parts of the original texture that are not blackened in the emissive texture.
  5. Finally, the model with the now partially blackened original texture and the emissive texture is uploaded to the Studio.
Cabins at night. An _Emissive.png texture used for inside walls.
The same cabins during day time.

If the lighting is to be able to be switched on and off, the model surfaces concerned must be present twice and alternately faded in and out using an animation. Accordingly, the texture areas that are used once for the unlit area and once for the lit area must be present twice on the original texture, with one version being adopted into the emissive texture and the other being blacked out there. This practice is also used for light signals and train lamps, for example, but also for the interiors of many passenger car models in the Studio.

However, this lighting method also has a disadvantage which is particularly evident in room lighting. If an illuminated interior is furnished, or if people are placed in the room, they will still remain dark at night with the “light” switched on, because the walls do not “radiate”, but only appear “bright” themselves. This light cannot be transferred to objects in the room. In order to make the darkened people in the room “bright”, there would also have to be “self-illuminating” variants, which would then have to be placed in the illuminated rooms instead of the original people. This problem cannot be solved satisfactorily with the current version of the Studio.

Lighting from Version 9

From Version 9Version 9 provides two basic types of lights:

  1. Real lights that illuminate the environment. These lights behave the laws of physics and illuminate surrounding objects. Real lights provide physically correct lighting effects, but place greater demands on computing power and too many could reduce 3D performance.
  2. Luminous surfaces can make an object light up without affecting the surroundings and without any loss of performance.

Real Lights

3D Train Studio supports three types of real lights:

  1. Point lights that emit light evenly in all directions (such as a light bulb)
  2. Spotlights that emit light from a point in a cone area (for example, car headlights, lanterns, etc.)
  3. Fluorescent tubes that emit light along a length (for example, fluorescent tubes, light strips, etc.)

When using Blender or another design program that supports lights, point and spot lights can be created directly in the 3D model and exported using the glTF format (the “Include – Punctual Lights” option must be activated in the Blender exporter). For simplicity, the Studio does not work with brightness values, but with distances. Brightness settings in the design program are converted to a distance at which the light brightness drops to almost 0.

If the design program or exporter does not support lights, they can still be integrated into a 3D model using special auxiliary objects. The auxiliary objects are automatically converted to lights when imported into the studio. The material color serves as the light color:

  • _PointLight{Name} – If an object begins with the name _PointLight, it is interpreted as a point light. The dimensions of the object determine the range.
  • _SpotLight{Name} – If an object begins with the name _SpotLight, it is interpreted as a spotlight. The dimensions of the object along the negative Z axis specify the range and direction, the dimensions along the Y axis are used for the opening angle. The alpha value of the material color specifies the gradient.
  • _TubeLight{Name} – If an object starts with the name _TubeLight, it is interpreted as a tube light. If the object is centered around the coordinate origin, the light is emitted in all directions and the dimensions of the object determine the range. If the object starts at the coordinate origin, the tube light is considered to be a directed light similar to a spotlight, with the dimensions of the object along the X axis determining the length of the tube. The dimensions of the object along the negative Z axis determine the range and direction, the dimensions along the Y axis are used for the opening angle. The alpha value of the material color specifies the gradient.
  • _InteriorLight{Name} – If an object begins with the name _InteriorLight, it is interpreted as interior lighting. This light has two point lights in opposite corners, which means that an interior is illuminated relatively constantly without affecting the outside areas. The light area is a cuboid, whereby the light position is always the local coordinate origin. By moving the cuboid vertices, the light can be freely positioned within the cuboid.

Note: Lights only support uniform scaling, i.e. equal scaling in all three directions. When importing into the Studio, an error message appears if non-uniform scaling is detected. At the same time, scaling can be a design element, for example to make lights flicker using a scaling animation. Please note that some exporters have problems with a scaling of 0. To hide lights using an animation, a very small scaling of 0.001 is sufficient.

Luminous Surfaces

3D models that emit light but have no influence on the environment are configured using the emissive property of the material. To make luminous surfaces switchable in the program, luminous objects in the 3D model must have the name _MeshLight{Name}, where {Name} is the name of the light as it will later appear in the Studio for control in light switches. A maximum of 256 different luminous surfaces can be configured per 3D model.

When switched off, luminous areas use the base texture of the material and when activated, the emissive texture, as long as the corresponding pixel has an Emissive value > 0. This allows luminous areas and non-luminous areas to be combined in common textures.

User BahnLand has produced a paper to explain the _MeshLight method.

The program author tells us that _MeshLight is intended for things like bright flashing lights, bright windows or neon signs, not to fake interior lighting. Emissive was necessary in old versions where there was no real light. From v9 onwards you can work with real light sources, and interior lighting using _MeshLight should only be used as the absolute exception.

The method of switching is to add an action when importing the model into 3DTS.

Older Models

Its not realistic to expect older models to be using the latest lighting methods. It can be a lot of work for a model author to update a model, they may no longer be active or they may have moved onto other projects.