Updated: March 1st, 2013. See Changes log in the bottom of this post.
In order to mod ETS2 3D content a ZModeler3 is required. The version this guide was written with is 3.0.2 Build 1007; later versions apply.
The SCS Soft Prism3D.zmf filter used in this guide is version 3.0.2 Build 162; later versions apply.
To unpack original game content a scsextractor is required. This is a command prompt tool released by SCS and it's beyond a scope of this guide.
Original game base.scs archieve must be fully unpacked, so all materials and textures are available for ZModeler3.
Your copy of ZModeler3 should have a valid license (trial or real) in order to Import or Export.
A GPS texture (attached to this guide) as a set of "gps.tobj" and "gps.dds" files should be extracted into "vehicle" -> "truck" -> "share" folder inside the folder you've extracted your base.scs file to. These files will not affect the game and are not required to be shipped with your mods: they are only supplied to make ZModeler load GPS material properly for truck interior models.
Import of 3D content
Start ZModeler3 and press Import button in toolbar (File\Import command in menu). Locate a folder with extracted base.scs file on your hard drive, then open there "vehicle" -> "truck" -> "man_tgx" and select truck.pmd file. An options dialog box will appear in the bottom:
Click on a wide button next to "base.scs:" label and specify the folder where your base.scs file was extracted to. You should do it only once.
Merge Models option should be toggled off. It will keep models as separate objects. If you toggle it on, it will merge objects inside one group into single 3D object. Both case are suitable for import/export, you might choose the one you like. If you have a model that has lots of groups (for each parts like headlights, front grill, glass etc.), it's preferable to use "merge models" - you will still get your parts separated as objects. If your model is not split into many parts (like original game models) you should disable "merge models" to get objects split by materials within each group.
When you import an animateable model, an option "merge models" will create you a single 3D object and a skeleton with bones for bone-weight skinning. Thus, you can create and export soft-skin a 3D model. If you toggle this option off, the filter will chop model into parts with respect to used bones (instead of used materials) and you will get a set of objects that you can animate. Both case are suitable for import/export, it's upto you to choose the one you need.
Press Import button in dialog to import a model.
An errors and warnings might appear in ZModeler3 log window, so pay attention to logged errors.
If you get an errors regarding missing texture files (usually related to "environment reflection" textures, you should copy any environemt texture into respective folder under respective name. Then reset scene (File\New) and reimport, so you have all textures loaded properly:
An error indicates that "vehicle_reflection.dds" texture was not found in "material/environment" folder. Locate this folder and copy any suitable file with the name of missing texture. For example, I've copied "ui_vehicle_reflection_s.dds" and renamed it to "vehicle_reflection.dds":
Now I get no errors or warnings on import.
You might notice that no object has apper in any views, while objects are listed in scene hierarchy of ZModeler's nodes browser. Objects are not shown in 3D view since their visibility condition (variant, state, switch) is not matched. This is a set of conditions (I prefer "state") that game uses to toggle certain visual parts visibility on/off. These states appear as a buttons on Structure tab of ZModeler's nodes browser:
You should press desired states combination to see a respective truck model parts. For example, toggle "A_cabin" and "Chs_6x4" and you will see 6x4 chassis with high-roof euro cabin:
Once you expand "truck" node in nodes browser, you will see bold labels for the most of nodes under it. Bold labels indicate that respective node (and nodes belonging to it) have "state" support and might appear when respetive states are toggled on. For example, "Cab_base" is the common cabin base exterior model and it will appear when any of A_cabin, B_cabin, C_cabin, A_cabin_uk, B_cabin_uk, C_cabin_uk is toggled; A group "Cab_eu" is the euro cabin interior geometry and it will appear when any of A_cabin, B_cabin, C_cabin is toggled.
State options can be applied to an object (geometry or dummy) under root model node only, or under collision node.
Thus, state switching can appear on nodes directly linked to "truck" root dummy node, or under "collision" dummy node. If you need a specific part to depend on some state, you should create a state-depended dummy node for it under "truck" root dummy and place your part there. Objects placed under a state-depend group dummy will be visible/hidden with it's parent dummy node, so when some dummy's state matches visibility condition, all objects under this group dummy will appear (geometry and dummy/flare nodes).
If certain group dummy node under root node is not state-depend (not bold), it will appear in all game variations with no condition.
In order to convert some group dummy node (or any other object) into state-dependent, toggle respective states on Structure panel, pick node in nodes browser and press Convert to Compound button. This will convert node from nodes browser into compound. ZModeler3 supports multiple compound states on node, but ETS filter does not and requires only one state on a node. So, if you need to change a set of states for your node (you can not add or remove condition state), you should revert node back to normal (by selecting this object in nodes browser and pressing Dismiss button) and convert it to compound again with proper state buttons toggled.
Collision model is the set of dummy nodes or 3D meshes stored under "collision" dummy node. In general, the same state-conditions logic applies to collision volumes, so you have collision matching a visible 3D model (with respect to state).
There is no specific guide on collision model, so just keep it as simple as possible. It's preferable to use dummy boxes where possible and avoid placing collision volumes too low, or your truck will constantly hit curbs.
Collision 3D volumes should not have any holes or open edges, so merge vertices all around. Never copy real 3D model into collision volume.
ETS2 uses a real-time shadows and cast shadows by rendering a low-detailed geometry found in your truck model file. It uses a specific shader named shadowonly that does not render to screen and used for shadows only. You might notice this volume crossing entire truck model all around - this is a simplified 3D model for a shadow. Locate a material in materials editor that states Adapt: shadowonly and untick a checkmark next to it. This will hide a shadow volume from 3D view in ZModeler (while it will it's keep wireframe in views). In order to create a shadow for you truck, you should alter a 3D model that uses this material. You can modify it, create new vertices, polygons or whatever you need, just make sure you assign the "shadowonly" material onto respective polygons then.
The deep shadow is rendered using a specific "ui_shadow" model files and a polygons mapped to material "fakeshadow" in your truck model. I didn't messed with this subject and can't give extended info on this kind of shadows.
The filter will export your model and bind it to newly-created material files (.mat files are created in the same folder).
In order to export a proper 3D model with proper materials, you should set them up in ZModeler using some guide rules.
Material file is NOT created if associated material is stored any in material group in materials browser. Look at the screenshot below. It contains mateirals that were created after loading "prefab/fork/hw2_fork.pmd" file:
You can see two groups in top-left corner (/material/road/ and /material/terrain/) and materials listed under these groups. These materials files will not be created on export and filter will refer to "existing" material under respective path. Thus, you can have a library of materials for your mod and share them among several scenes or pmd files. On the screenshot above the only MAT file created will be the one for "hw2_fork_4_grass_main" material, sinct it does not appear in any groups.
You can assign groups to materials using drag&drop operations. You can remove material from group by dragging it onto topmost "All Materials" label. Once you do it, a material file will be created for respective material.
The filter creates MAT files in the same folder as the target exported file. It uses material names to create material files, so make sure your material names do not overlap if you export multiple files into the same folder. For example, when you export "anim.pmd" and "model.pmd" into "interior" folder. If it's intended, you can give the same material names to use a benefit of reusing .mat files.
The most important material settings you should pay attention to is material adaptation that appears as Adapt: label on each material. This is where you specify desired ETS shader for your material. There are no specific rules here, it's a question of practice. The list of supported shaders follows (with preferable ZModeler shaders matching):
- Code: Select all
Also, most of these shaders can take extra settings when respetive settings appear on ZModeler materials:
.day when user-defined option "DAY" is set,
.night when user-defined option "NIGHT" is set,
.airbrush when user-defined option "AIRBRUSH" is set,
.tm0 when user-defined option "UVMAT" is set (no idea what's this)
.paint when user-defined option "PAINT" is set (for ETS/GTS only)
.bilb when user-defined option "BILLBOARD" is set,
.flat when user-defined option "FLAT" is set,
.tintadd when source blend is "Source Alpha" and dest blend is "Dest Color",
.over when source blend is "Source Alpha" and dest blend is "Inv Source Alpha" (default blend mode),
.sub when source blend is "Zero" and dest blend is "Inv Source Color",
.mult2 when source blend is "Dest Color" and dest blend is "Source Color",
.mult when source blend is "Dest Color" and dest blend is "Zero",
.add when source blend is "Source Alpha" and dest blend is "One",
.asmooth when source blend is "Source Alpha" and dest blend is "Inv Source Alpha" and Alpha test is on,
.decal when source blend is "Source Alpha" and dest blend is "Inv Source Alpha", and "Z Correction" and "Render Last" options are toggled,
.noz when "Z Write" and "Z Test" options are off,
.nocull when "Doublesided" options is toggled,
.a when Alpha Test is toggled on,
.tg0 when dual-diffuse shader uses "World XZ" uv mapping on second texture (terrain modelling).
You can check availability of associated options on each shader by checking "effect/eut2" folder and respective shader subfolder for associated *.rfx files.
In general, if you deal with truck models and trailer models only, you will use generally
dif, dif.lum, dif.spec, dif.spec.add.env, glass, truckpaint, shadowonly and fakeshadow.
The rest is mostly for scenery and environment.
Material states or company looks for trailers are well-described in this guide and fully apply to ETS2 modding:
Truck paintjob is applied via shader "truckpaint" (specified in adaptation of material). In ZModeler you should apply any desired "DualDiff" (two diffuse map) shaders, "Dual Diffuse+Spec+Env" is preferable. The main (DETAIL1) texture is the main color texture of your truck and it's alpha channel is a specular level (you can set it on SPECULAR page next to "Map:" and specify "DETAIL" "A" there instead of "SPECULAR" "RGB". Thus, you don't have a specific specular map texture and use Detail's texture alpha. Environment texture should be applied if you want your truck to have real-time refelctions. Use any of stock "material/environment/vehicle_reflection.dds" textures.
The DETAIL2 texture is the paintjob itself. Since ETS uses R,G,B,A color masks separately for painting specific colors onto model, the paintjob texture is mostly black (non painted) with some arears having red, green, blue or alpha data. Load any paintjob onto your truk model (you can use "vehicle/truck/upgrade/matching_pattern.dds" for simplicity). The painjob textures are shared among trucks and your truck have to match a predefined template/pattern. Thus, you have to create additional UV mapping on Manual UV #2 for all meshes you would apply your "truckpaint" shader to. So, specify UV Coordinates comes from: Manual UV #2 on DETAIL2 sampler slot:
and make sure your truck geometry have second UV channel (in properties, on Mesh\Vertices\Format):
(Here's a guide how to reach object's properties: viewtopic.php?f=23&t=5693)
Then you can generate UV Mapping for channel #2:
A minor note about textures: You should keep your truck textures in the same folder as the truck model. The filter will create texture reference files ".tobj" in the same folder for any texture that does not belong to any group. The rule and idea here is exactly the same as material groups shown above. The only difference is that textures browser does not show texture names under respective groups, instead you click on a group and see a tiles of associated textures only. On the image below only two textures are in "/vehicle/truck/share/" group, while theare dozen of other textures are loaded and used on materials in scene:
The same rule regarding .tobj files applies: the filter will not create .tobj files for textures in groups, instead it will refer to textures on respective paths. For example, it will create references to /vehicle/truck/share/dashboard.tobj and /vehicle/truck/share/glass.tobj files on export, but will not create these files.
You can export a scene to the file named exactaly as the scene root node. For example, if your scene root is entitled "model", you can export to "model.pmd" file, but can not export to "my_test_model.pmd". Thus, if you have "model" and "anim" root nodes in your scene, you can export to "model.pmd" and "anim.pmd" files and respective scene branches will be saved into respective files.
.pmc file is created if "collision" dummy node found
.mat files are created for all used materials that don't belong to any material group in browser
.tobj files are created for all textures used on exported materials if they don't belong to any group in textures browser
.pmg and .pmd are always created even if export fails by some reason.
The location or path of each material or texture file that ZModeler creates is pre-configured. Full path is obtained from the Origin user-defined keyword that you should set on a root dummy node. For example, if your mod will be in "/vehicle/truck/scania_rcab_2009", you should set /vehicle/truck/scania_rcab_2009 for an Origin user-defined option on "truck" dummy node. Check this thread for details on object's user-defined properties.
Thus, your model file (PMD) will refer to material files (MAT) using the Origin path and your material files will refer to texture files using the Origin path too. If you get a shader or texture problem in the game (red/pink model) or an error that the engine can't open specific material or texture file in read mode, the problem is potentially in a wrong Origin value set when the export was made.
Mod packing and testing
If you've ever modded SCS games, you are familiar with mods packing and testting.
You should place your mods files into folder "My Documents/Euro Truck Simulator 2/mod". For example, to create a mod for MAN TGX model, you have to create somewhere test folder vehicle/truck/man_tgx, export there, then pack this "vehicle" folder (with subfolders) into a mod and put this mod into My Documents/Euro Truck Simulator 2/mod folder.
For simplicity, I create the test folder right in mod: My Documents/Euro Truck Simulator 2/mod/vehicle/truck/man_tgx and export there (I use to test only one mod at a time). Then I pack "vehicle" folder right in "My Documents/Euro Truck Simulator 2/mod" into a mod and test ingame.
The game will not deal with loose files stored in "mod" folder, it will respect only mod packages.
Mod package is just the ZIP archieve. You can use ZIP with no compression and specify ".scs" as file extension (old-school) or you can zip into regular .zip file with any compression level prefered (nowdays).
This thread is locked for discussion. Post your questions in respective topics
3.0.3 Build 172, 21st January 2013.
Base.scs file location is specified via drop-down combo box.
You can have several paths saved and pick a desired base path with a single click on import.
3.0.2 Build 170, 16th November 2012.
A "eut2.lamp" and "eut2.lamp.env.add" shaders added. Both shaders require DETAIL2 texture-mask with red, green, blue and alpha channels as intencity mask for Break, Turn, Reverse and Light states. This texture must use Manual UV #2, so you can create quality overlay image with it's own UV mapping for this purpose.
Note, the front-left headlight should be mapped to UV texture square (name it first square), the front-right headlight should be mapped to the one square to the right side of original texture beyond the right bound of texture square (name it second square), the rear-left taillight should be in the "third" square on the right and the rear-right taillight should be on the "fourth" square. Note, you can map them all onto main (first) square and then move respective mapping objects to the right on 1.0 unit, 2.0 unit and 3.0 unit. Use Modify\Move tool with "Y" axes constrain off - start moving and press Tab key to bump input box; type there 1.0 and press enter to move onto "1.0" distance.
3.0.2 Build 168, 2nd November 2012.
An option to create local .tobj and .mat files is added in export dialog.
When option is toggled, the filter will create all .tobj and .mat files in the folder your are exporting to even if respective textures or materials are stored in groups and suppose to have different destination folder location. TOBJ files will still refer to textures (as well as MAT files will refer to TOBJ files) using the path specified in respective texture's group name. Thus, the option forces the creation of tobj file (so you can copy it where needed), but it's location and paths are still controlled by texture's group name in Textures Browser. MAT files, however, can be retained in your exported folder and PMD will refer to them using the scene's Origin path. If this behaviour is not intended, reexport with option toggled off.
Friendly shader names are added for simplified "Shader Adaptation" management
Each shader name configuration the filter will find, it will add a row into Profile\Preferences\Filters\SCSPrism3D\Shaders branch (see ZModeler's settings window). You can specify there a friendly name for each shader combination you like. The next time you import, the filter will set material adaptation name with respect to given friendly name.
When you export, the filter will check for friendly name and use exact shader name if it matches. Thus, even if you change some options of material that normally would affect target shader name (e.g. ".over", ".shadow" and other options), these options will be ignored and explicit shader name (matched on friendly shader name) will be used.
This can be used for conversion purpose. For example, you can specify friendly shader name "myglass" for shader "eut.none_spec.add.env.tintadd" (used for glass in ETS/GTS) and the same friendly shader name "myglass" for shader "eut2.glass" (used for glass in ETS2). Then you will be able to import ETS model and export ETS2 model without any changes in glass material, it will be converted properly.