Menu

Importing a new model into the Material Editor

June 12, 2017 - Material Editor, Modding, Models, Textures, Tutorial

We will start from Assembly Properties panel (far left icon in the Menu bar). For importing a new mesh it is best to start with an empty Assembly Elements list as displayed in the left image:

2_AssemblyProperties3_AssemblyElements

 

 

 

 

 

 

 

 

 

 

 

 

Next we’ll add a new mesh as shown on right image. That mesh will serve as a base to load our new mesh. After adding a new mesh, in the viewport there will be visible cube mesh, as seen in the next image.

4_Overview

Double-clicking on MDL Box entry in the Elements list will hide Assembly Properties panel, and show Model Properties panel. This is the main panel for working with the selected mesh’s material. Here we can change which texture the mesh will use, what parameters for the material are, does mesh cast and/or receive shadows, and even change the shader that is used. The Model Properties panel is shown in the following image:

5_ModelProperties

Now we’ll import new mesh. There are a number of restrictions on the mesh type that is imported:

 

 

 

 

 

 

 

We import a simple test sphere. When the mesh is imported it will use default material values:

6_Overview2

In this tutorial we will focus on the default shader for opaque solid materials.  Shader is named spg_pbr_shader.fx. Shader defines how the material parameters and textures are used, and each shader in the game has different usage of the parameters and textures. On the image are parameters used by the spg_pbr_shader.fx

7_ModelParamsEach texture has different usage.

 

 

Next we’ll show how parameters affect the appearance of the mesh. The textures used for demonstration are from a site about PBR materials, http://freepbr.com . Materials are free for use, and the site has very good quality materials. We highly suggest that you visit it and since the materials are free you can use them for your models.

8_Overview

Textures used are for rusted iron that can be downloaded here . The albedo and normal map can be used directly but for the special it needs to be created. Since the game engine works with glossiness (which is roughness inversed), the texture provided (rustediron2_roughness.png) needs to be inverted when putting into special texture’s green channel (the channel for glossiness). For this material the specular intensity (red channel in special texture) can be set to white. The blue channel is for self illumination and it should be set to black (except if we wish for the object to emit light). Engine uses dds texture format, and for special and normal texture it should be saved as: 8.8.8.8   ARGB  32 bpp | unsigned, with mip maps generated. Textures saved in this format are uncompressed and have best quality and for normal and special textures there can be visible artefacts if they are saved in compressed format. For the albedo (diffuse) texture it can be saved as compressed DXT5  ARGB   8 bpp | interpolated alpha format since the visible artefacts of compression are much less noticeable.

Now when we have prepared the textures, we can load them and tweak (if needed) the parameters.

9_Overview

10_CheckerTextureThe sphere in the image is contained within a box, but the box has holes that are fully transparent. The alpha channel of the diffuse texture used is a checker pattern:

 

 

 

 

 

 

 

 

 

 

 

 

 

After we have calibrated material parameters we can save the model into whale engine format, by clicking on Save Whale Model icon. Now the mesh is ready for usage in assembly and with it in game.


 

Continue to the next article:

Leave a Reply

Your email address will not be published. Required fields are marked *