ETS2: Mesh light and shadow tutorial.

SCS Software ATS and ETS2 editing using ZModeler3 filter. Models, Materials, Animation.

Moderators: Oleg, _RicH_

ETS2: Mesh light and shadow tutorial.

Postby Oleg » Fri Feb 08, 2013 11:40 pm

The ETS2 game use a common lighting technique for an object geometry, when the mesh is lit by any light source. It uses vertices normal directions to determine the level of shading, it produces smooth shading across polygons using normals of respective vertices.

But what happens when the object is not lit because of an obstacle casting a shadow to surface? The game engine will not compute lighting at all, assuming the light does not reach the surface. The ambient light (very dark) is used as an overal scene lighting, and the shadowed polygons appears like they are flat or look like 2D sprite on your screen. Unlit polygons shaded this way are complete unreal since this kind of shading does not reflect in real life experience. Most of the objects inside a shadow of the shadow-caster object are about to be lit by reflected light from other neighbour surfaces. Even an object casting shadows to itself will generally reflect some light to itself too. As a result, some areas of an object would get light even been in a shadow of an obstacle-object. And some areas (hard to reach) would not get any reflected light.

The reflected light is hard to compute in realtime, and nearly impossible for dynamic or moving parts. The consideration made is to compute reflected light on a mesh to be static, or literally "precomputed". The volume of light that could reach the surface is generally the brightness of the object in shadow. In other words, the less direct or reflected light could reach the surface - the darker the surface will be in a shadow. The technique is well known as "ambient occlusion". It is a precomputed shading that adds some darkening to surfaces in areas where light will barely reach the surface, even reflected.

The technique is computation expensive and barely used in realtime. Instead, a static computation used. ETS, GTS, ETS2 models store precomputed surface ambient occlusion on a diffuse map (also known as "baked" shading) and (the most important) it stores shading on per-vertex level. Literally, each vertex has a color from dark-gray to bright-gray in order to emulate ambient occlusion shading. This is a very fast for rendering in game at almost no cost, so each mesh in ETS has a precomuted shading.
What will happen if you don't use prelit vertices color? The vertex color will remain bright white (the default color) assuming the vertex is potentially easily reachable by reflected light. Such a model will appear to be much brighter in shadows than the rest of scene, and the model will be kinda a horse of another colour.

You can enable Diffuse color in format of a vertices on your models, but you don't need to paint this color. Instead, ZModeler tools will do the computation and paint vertices respectively.

The video guide will show you an easy way to create per-vertex prelt color for a model in ZModeler. The first part will prelt the truck model:

The second part is for interior model and uses mostly the same methods as the first one:

Complexity level: Intermediate.
Time required: 5-30 minutes.
User avatar
Site Admin
Posts: 8276
Joined: Fri Feb 06, 2004 3:54 am

Re: ETS2: Mesh light and shadow tutorial.

Postby xxGRIZLIxx » Fri Feb 22, 2013 3:51 am

Posts: 2
Joined: Fri Feb 22, 2013 3:48 am

Re: ETS2: Mesh light and shadow tutorial.

Postby Mike3D » Sun Mar 31, 2013 7:17 am

Thanks man, it really worked :) Now start to build a better pc 'cause its very heavy ;)
Posts: 17
Joined: Sun Aug 05, 2012 2:47 am

Re: ETS2: Mesh light and shadow tutorial.

Postby Kotton » Tue Apr 15, 2014 11:17 am

is this Zm3 specific? ..or can we achieve the same/similar results in Zm2?

regardless, VERY nice Oleg, exemplary work on Zm3!
User avatar
Posts: 97
Joined: Mon Dec 08, 2008 2:51 pm
Location: IE, SoCal

Return to ATS and ETS2 by SCS Software

Who is online

Users browsing this forum: No registered users and 1 guest