Material States (ETS/GTS Paintjobs or Company looks)

Tutorials and quick guides collection is posted in this forum. Forum is read only.

Moderator: Oleg

Material States (ETS/GTS Paintjobs or Company looks)

Postby Oleg » Sun Aug 12, 2012 2:45 am

Material states settings guide.

This guide will describe the set of steps you have to perform to create custom "Paintjob" or "Company look" for ETS/GTS scene. This applies to general PMD export too (including truck interior models export and scenery exterior prefabs).

The idea behind states.
In most of modern games it's a good practice to reuse shared resources as much as possible. If it's possible to have one geometry model to be textured in different ways depending on certain in-game conditions, it's very preferable to have the same geometry using different materials for rendering. For example, the daylight and nighttime buildings use completely different textures set, but the overal model is exactly the same. To reduce mix of materials and their assigment, the commonly used consideration taken is to adjust materials properties or replace their textures instead of assigning completely different materials set for the model.

This is the basic idea behind material states: ZModeler will change settings of materials (or textures) when certain states are toggled on/off. In case of ETS model this could be considered as "toggling company look #1 would switch skin #1 on trailer, while toggling company look #2 would switch skin #2 and so on".

Prepare scene and materials.

In this guide, I'll show material states on torus object just for simplicity. It will have two materials: a plain color (this will be used as for a set of polygons that will not change when states are toggled) and a textured material that will be affected by states. Both materials should be Shader materials assigned to torus object. Just in sase you don't know how to do it, drag and drop "shader material" label onto material sample, then drag and drop desired shader onto material sample. Then assign material to polygons:


Double-click on textured material to bring it's properties window, scroll down to DETAIL sampler page (this is a diffuse texture sampler settings page) and press wide button next to "Texture map:" label. This will bring textures browser window. Load three textures (skins) into textures browser. I've loaded ETS container textures:, and


I've selected "" and pressed Ok. Now this is a textured used by my "textured" material:


We are ready to create custom material states now.

Creating custom material states.

On the scenes nodes browser in Structure tab, press the "New state" button. A dialog box for new state will appear. Specify there a name for the first state (I've used "EURO" for euroacres), tick "Affect Materials" and "Exclusive" options. Then press OK:


Option name Affect materials is self-explaining. Option Exclusive means that this option can not be combined with other exclusive options at a time. Consider exclusive states as mutualy exclusive options. For example, the trailer can not belong to several companies at a time and can not show dirrent paint skins at a time.

Create the second state the same way. I've created "TRANS" for transinet paint look. Notice, both states are under a drop-down combo now. This means that you can select only one of them at a time:


An option selected in drop-down list will be shown on drop-button after selecting, but this state is not active unless you push the button itself. So, select the first entry in drop-down list then push the button. This state is active now and affects materials:


Nothing has changed in scene or viewports since our materials are not yet set up to be affected by newly-created states.

Setting up material to reflect state changes.

Open material browser and double-click on textured material to bring it's properties. Scroll down to "Material States" page. Notice it shows current material states in the bottom ("EURO" on screenshot below). This is a currently-selected materials-affecting state. Press "Add current" button to add this state into the list:


As soon as you press "Add current" button, current state will be added to the list of states that this material can reflect. If a certain state in a list matches currently selected set of states, this state has bold text. Also, notice that "DETAIL" sampler page became completely blank:


This means that settings for this sampler on current state are not changed and kept the same as on material in it's default state. When you deal with complex shaders, most of their samplers will be left unaffected, while "DETAIL" sampler is the most commonly affected sampler.

Since we need custom texture to be used for state "EURO", tick the Overload sampler for current material state checkmark and sampler dialog will become active as usual. Note that you edit sampler settings for current state as selected in Structure tab, but NOT a state of currently selected entry in a list of materials state.

Replace sampler texture to the one that matches current state. "" in my case for state "EURO":


Once you picked texture for "overloaded" sampler, a torus in viewport has changed. That's because we've done setting up material for current state.

Pick the second state from states drop-down combo in scene nodes browser and notice your material has reverted to default state (since material does not reflect this state). Make sure the drop-down combo is pushed (state is active), and repeat the assignment for this state too ("Add current", "Overload sampler for current material state", load desired texture).
Do the same for the second state ("TRANS" in my case that will use "" texture):


You can close material browser now and simply toggle on/off state in scene nodes browser and see changes in 3D viewport instantly.

Export specific.

Exclusive material states are automatically converted to painjobs or company looks on export to PMD. Note, that missing exclusive material states will force filter to create one state named "Default". In my case when no states are selected, my material shows "" texture on it, considered this is a "default" state of my textured material. This will not be exported when you have any material states defined (only "EURO" and "TRANS" will be exported). To make a proper export in such a case, I would need to create a state for initial setup too (probably named "Plain") but I would not need to set up material sampler to "Overload sampler for current material state" for that state.
User avatar
Site Admin
Posts: 7398
Joined: Fri Feb 06, 2004 3:54 am

Return to ZModeler3 Knowledge base

Who is online

Users browsing this forum: No registered users and 1 guest