Info Glass and Translucent Materials in OMSI 2

Road-hog123

An Orange Bus
Administrator
UKDT
Dec 10, 2015
1,784
The main one is the way glass surfaces look. The Geminis spring to mind here as they are the worst offenders I've come across, but has anyone else noticed that every single glass surface (particularly on the original) looks like they've got about seventeen layers of protective film over them? Glass shouldn't be invisible, but it shouldn't be distracting.
In reality, glass is a quite complex material... translucent materials like glass have a refractive index, which not only affects the path of light through a material (as in seen in school physics experiments), but also the critical angle for total internal reflection, i.e. the angle at which (in theory at least) 100% of light hitting the surface is reflected off of it. Of course imperfections in the glass scatter light and so glass is never completely 100% reflective, but the point is that depending on the angle of the glass, the amount of reflected light changes.
9c07a1747e13051d90824cf2c254c322.jpeg
You can see this effect in this photo I took of a bus in sunny weather - the side windows are in shade, but where bright white buildings to the left reflect lots of light onto them, it reflects brightly back to the camera, overpowering almost all of the light bouncing out of the interior. The windscreen is in direct sunlight, but because of the different angles, the light is reflected off in different directions or passes straight through, so the details of the interior are not overpowered
Omsi on the other hand, has a single reflectivity value from no (0) reflectivity to total (1) reflectivity, which isn't affected by the angle the glass is viewed at. So do we set glass to be really reflective like the side windows above, or not so reflective like the windscreen? The best choice is usually to favour the latter, so you can actually see through the glass, but what works best is a fine balancing act.
If it being a fine balancing act wasn't enough, by default Omsi uses the alpha (transparency) channel to map reflectivity to a texture. So if you have a body texture with no transparency, whatever value you define reflectivity of your material as in the environment map (envmap) definition, that'll be what you get. With translucent things like glass, you'll get less than you define. For example, the outside texture for the C400(R) glass has an alpha value of 153. 153 / 255 is 0.6, so our envmap value of 0.33 in the model file gets reduced to 0.198, which is actually how reflective the windows are once in the game.
Reflectivity (environment maps) are added to materials as such:
Code:
[matl]
Glass inside.png     <- the name of the texture the material you want to affect uses
0                    <- where multiple materials with the same texture exist, this allows you to select later indexed (zero-based) ones

[matl_envmap]        <- tells Omsi you want an envmap
envmap.bmp           <- name of the texture used for fake environment mapping
0.21                 <- how strong the effect of the envmap is
If you want to make a material evenly reflective, but have differing levels of transparency across it, you'll want a transparency map (transmap). One of the red, blue or green channels of the transmap texture is used as an alpha channel for the main texture, who's alpha channel is instead being used for reflectivity... Your texture will therefore be a greyscale image, darker areas will result in more transparency, light areas will be more opaque. You can then make the whole main texture evenly transparent or adjust the transparency for certain areas to change how reflective parts of a surface are (so a texture with plastic, metal and rubber can have different levels of shiny on each ;) ).
Code:
[matl_transmap]
Interior glass_transmap.png     <- the name of the texture to be used as a transmap
:)