Materials guideline

Setup of materials in ZModeler for proper export.

Moderator: Oleg

Materials guideline

Postby Oleg » Wed Jan 07, 2015 7:36 am

Watch Dogs Materials and shaders guideline

Materials setup is very important to get properly looking model in game. Most of shaders utilize bump-mapping and exported with tangents for bump-mapping even if actual bump texture is missing, additionally, most of shaders utilize 2 UV channels. Most of these shader-specific limitations are transparent and you should not care of them: this guide will cover the settings that you should be aware of and settings that you are responsible to configure.

Reference materials set: create your library
First of all, ZModeler has a feature for loading and saving materials straight from Materials browser. This is very helpful, as you can create a set of reference material files buy coping original *.material.bin files and renaming them. Thus, you can have a pre-configured materials that you can load when needed and replace texture maps on them to match your current project.

Debug printout of material settings
Second, the filter gives your a keyhole view to internal content of binary material files by creating a debug text file with material settings written there. This option is enabled by default and can be turned on/off by changing "DebugMaterials" property in Options\Settings\Profile\Editor in Profile\Preferences\Filters\WatchDogs branch. The text file is created when you import a model and it's created when you load individual material file in materials browser. Thus, you can compare content of an original material (if applies) and the one ZModeler created for you. Note, the text file is created on import only, so to explore content of zmodeler-generated material files, you should re-import your model.

Materials group: the path for material file
With respect to "Path and folders guide", you should arrange your materials into folders, so they do not interfere with other mods. If needed, you can retain original material filenames on import (use option "Retain mat-names"), so the filter will not change names of materials and an exported model can utilize original in-game material files rather than zmodeler-generated. ZModeler will still create you required *.material.bin files, so if original materials usage is intended, just delete respective files/folder after export. Beside the location of material, the name of material could be important too. For example, the game will automatically apply variative paint color scheme onto material named VehicleName_CarPaint_01. Thus, if you have material named that way, the game will ignore your settings for some reason and will use it's own replace color variants for it. Note, when you use "Retain mat-names", you will see the file name in materials browser instead of material name, so it will look like "jlesage-m-2012022840268104.material.bin": the actual name of material will appear in user-defined options of material as "Name" property.

Shader Adaptation
Shader adaptation must be assigned prior to exporting the model. Proper shader adaptation is a must, so make sure to get the suitable one and configure material with respect to specific export-shader needs. I have created a guide topic for each shader adaptation that is supported to the moment, so refer respective thread when needed. Each material will get configured with respect to the shader adaptation needs on export. I've ported most of the settings onto ZModeler options, but some options are still stored and applied as user-defined options.

User-defined options
User-defined options can hold parameters for your material that is impossible to put onto ZModeler material settings. You can edit, delete or assign other parameters. The file "common.dat" has a folder "engine\shaders\materialdescriptors" folder that contains XML descriptor for all shader adaptations. You can check these files for inspiration on what parameters are avail on each shader adaptation. ZModeler give you a chance to force your own values for any parameter you need: just put the user-defined property with correct name of parameter (case sensitive) and specify it's value, so ZModeler will use your value instead of the one it evaluates from your material setup. This is a bit messy but sometimes you might need this trick to force ZModeler to export some values on parameters that are barely reachable via other material settings. Note, ZModeler utilizes not all of the listed shader adaptations, and some shader adaptations are currently for import-only.

Beside a mentioned earlier "Name" user-defined property, you can create an additional property named Damage. The Damage property will let the exporter know the specific behavior of geometry on that material. For example, the vehicle tire is one of materials that needs this property: you specify there object names that should behave as a single "damaging part" in game. For example, when you shot the front left tire, all vertices on front-left tire will respect the in-game specific deformation code for deflated tire rendering. If this property is omitted, visual tire deflate will not happen, as the game will be unable to locate "damaging part front-left-tire" in a set of model geometry. The property Damage requires a set of case-sensitive object names to be listed in comma-separated text line. Each name (or empty slot) is the damage part index, so the property like this:
will evalue to "TireFront_L" has index 4 and TireFront_R has index 5, since objects with indices 1,2,3 are not available on this material. Damage part index is not editable and coded in model physics and collision *.hkx file, so you should retain indices of original model to have correct behavior in game. For example, if you see the front windscreen cracking when shooting the rear-left door, this is because the windscreen object got wrong "damage part" index on respective material due to incorrect "Damage" property value assigned.

An additional note on material properties: ZModeler allows to override properties on import for each shader adaptation. For example, a default vehicle-paint material on all vehicle models natively stores a black color, so all models will load in black color unless override is used. The override values are stored in profile and can be edited/added/removed if needed. The color override for vehicle-paint material mentioned above is located in "Profile\Preferences\Filters\WatchDogs\Shader Parameters\DriverCarPaint\DiffuseColor1 and DiffuseColor2. You can change the bright blue color there to the one you like more, so the loaded models will appear in a color you need. Changes will take effect after restart of ZModeler only.

Reflections and ENVMAP texture slot
Most of game shaders support environment reflections. This usually includes support of custom maps or pre-defined sphere-map textures and two standard reflection types: dynamic world reflection and static world reflection. The first one is used generally on vehicles, so reflection map is constantly updated to reflect real-time environment around the object. The second is used on small parts or buildings to simulate chrome or reflection effect on surfaces that don't need real-time reflections. Static reflection is updated rarely to reflect time of day only, so it includes a surrounding objects reflection but does not retain the real-time changes. You will probably deal with these two types of reflections only and ZModeler will use a pre-defined texture to determine the type of reflection you need. You should create sphere-map texture (take any you like) and name it as and the one named Put these textures into any folder reachable for ZModeler's texture search (Options\Services\Textures -> Add). Once these textures are available, ZModeler will load and assign them on materials to specify whether certain material needs a dynamic world reflection or static world reflection. These textures are not used by the game, you don't need to put them into any folder or pack into your mod, these texture names are only used to configure and apply correct reflection scenario for material on export.
User avatar
Site Admin
Posts: 7390
Joined: Fri Feb 06, 2004 3:54 am

Return to Shaders and materials

Who is online

Users browsing this forum: No registered users and 1 guest