ETS2: Mesh light and shadow tutorial.

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

Moderator: Oleg

Post Reply
User avatar
Oleg
Site Admin
Posts: 14044
Joined: Fri Feb 06, 2004 3:54 am
Contact:

ETS2: Mesh light and shadow tutorial.

Post by Oleg »

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.

Image
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:
-0eKj-loZmU

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

Complexity level: Intermediate.
Time required: 5-30 minutes.
xxGRIZLIxx
Posts: 2
Joined: Fri Feb 22, 2013 3:48 am

Re: ETS2: Mesh light and shadow tutorial.

Post by xxGRIZLIxx »

good
Mike3D
Posts: 17
Joined: Sun Aug 05, 2012 2:47 am

Re: ETS2: Mesh light and shadow tutorial.

Post by Mike3D »

Thanks man, it really worked :) Now start to build a better pc 'cause its very heavy ;)
User avatar
Kotton
Posts: 97
Joined: Mon Dec 08, 2008 2:51 pm
Location: IE, SoCal
Contact:

Re: ETS2: Mesh light and shadow tutorial.

Post by Kotton »

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

regardless, VERY nice Oleg, exemplary work on Zm3!
rustydog666
Posts: 2
Joined: Fri Jul 19, 2019 11:05 pm

Re: ETS2: Mesh light and shadow tutorial.

Post by rustydog666 »

how do i remove vertex paint and prelit colors??
User avatar
Oleg
Site Admin
Posts: 14044
Joined: Fri Feb 06, 2004 3:54 am
Contact:

Re: ETS2: Mesh light and shadow tutorial.

Post by Oleg »

paint vertices manually to a color of your choice.
rustydog666
Posts: 2
Joined: Fri Jul 19, 2019 11:05 pm

Re: ETS2: Mesh light and shadow tutorial.

Post by rustydog666 »

thanks Oleg, i had tried this but it seemed to not work. maybe i have missed something. selected all vertices i wanted to repaint and hit the fill selected but nothing was happening. will give it another go when i get on computer
User avatar
Oleg
Site Admin
Posts: 14044
Joined: Fri Feb 06, 2004 3:54 am
Contact:

Re: ETS2: Mesh light and shadow tutorial.

Post by Oleg »

The material type assigned onto an object should be "Shader Material" (with any shader applied). An option "Ignore vertices color" (Advanced color options rollup page) should be toggled off.

Object's properties (Mesh->Vertices->Format) should contain "Primary color" option toggled.
Post Reply