Lights at Night
There are four ways to make an object light up at night. The last of the four is the recommended method.
1. _LS Objects
An 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. This has been tested – and indeed, LS objects don’t work in v7.
2. _LC Objects
An 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.
LC objects don’t work in models which have been setup as splines.
LC objects are described in the wiki for v7 but not in the wiki for v8. The changelog does not say LC objects have been dropped, and they still work in v8, so the omission from the wiki may be unintended. However, it seems likely they are being phased out in favour of the use of emissive objects, see section 4 below.
3. Setting a value for Emissive in Blender
Objects can use an emissive texture in Blender. The brightness of depends on the setting for emissive strength within Blender.
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
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 and the least level of detail is limited to 3 materials. This may be a restriction in models which use several textures.
4. Emissive Textures
The Studio provides a method to set daytime and nighttime 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:
- Use full original texture to texture the model.
- 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.
- If the possibility of overexposure when displaying the model in daylight is acceptable, the model with both textures can be uploaded to the Studio.
- 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.
- Finally, the model with the now partially blackened original texture and the emissive texture is uploaded to the Studio.
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.