How to export materials from the game engine and apply them to other platforms

This solution is an extended application of game engine materials. It mainly exports the PPBR material resources in Unity3D and applies it to the SuperMap iClient3D for WebGL platform to improve the display effect of the model.

Use background

In the transportation, power, planning and other industries, some objects often have a strong texture, such as metal texture of the rail, power tower; ceramic insulators; glass material of the building curtain wall, etc., but the performance of the conventional way is often unsatisfactory.

The game engine (Unity3D) has a rich material library, such as glass, metal and other materials, many of these materials are PBR materials, the texture is obvious, the effect is realistic.

How to export these material resources based on the game engine plug-ins we provide and apply them to the SuperMap iClient3D for WebGL platform to improve the display effect of the model is the main content of this document.

Main process

Making PBR Material

First of all, we will introduce how to make PBR material in game engine, and understand the common adjustment parameters and texture map types of PBR material. Users can also go directly to the Internet to find some existing PBR material resources, import projects, and use them.

Metal material production:

  1. Create a Unity Project

  2. Right-click and create a new material named Metal

  3. Modify material color, metallicity, smoothness parameters; assign them to models in the scene to see the effect


Marble material production:

  1. Import the texture needed to make the material into Unity (related base color texture, normal texture and other resources need to be downloaded from the material website)

  2. Create a new material called Marble
  3. Drag the imported primary color texture (Marble_Albedo) and normal texture (Marble_Normal) to the box in front of Albedo and Normal Map on the Marble material, respectively;

  4. Import existing material assets: If you already have the material assets you need, you just need to import them into Unity Engineering. It should be noted that the material resource is Stadard Shader as much as possible, and currently only supports the export of parameters such as base color, base color texture, metallicity, smoothness, normal texture, etc. Other parameters and texture maps are not supported for export. RoughnessFactor value, cannot be 0;Tiling keeps default value 1.

Install Game Engine Plugins

Refer to this manual for the contents of the Installation Guide.

Export PBR materials

  1. Click the shader you want to export, right-click, and select SuperMap-Export Material json option in the pop-up panel;

  2. Pop up the Save Json Path panel and select the saved path.
  3. Unity Console panel, prompt export success;

  4. Use the same method to export other materials such as Marble.

  5. An exported material consists of two parts: the Json file and the texture map used. Among them, Json file records material parameters such as metallicity, roughness, and the relative path of reference maps.

In SuperMap iClient3D for WebGL, use the exported PBR material

Two ways: 1. Specify the layer and set the PBR material of the layer;2. Set the PBR material of the layer object in the way of thematic map.

Method 1:

Use the setPBRMaterialFromJSON interface under S3MTilesLayer to set PBR material effects for all objects in the layer, one layer corresponds to one material effect. Take metal materials as an example:

First find the layer where you want to set the metal material. In this example, use the Metal material for the manhole cover layer and the Metal_Normal material for the pipe layer.


Effect after setting:


Online Reference Website: support.supermap.com.cn:8090/webgl/examples/webgl/editor.html#showUnderGround

Method 2:

Use the thematic map to set different materials for objects with different attributes in a layer.

For example, in this example, in the guidao_qiu layer, there are three kinds of objects: 1. ceramic insulator object; copper sling object; aluminum other objects.

Specific settings:


Final effect:


Note: Thematic map mode currently supports only PBR materials without texture.

Usage scenario

Here, three usage scenarios are listed according to common data types. Users can make corresponding materials and use them according to their own data types.

BIM and pipeline data beautification

Railway track, catenary and other data and pipeline data in BIM often have no texture, and have a wide range and strong texture. When we make Json material files for beautification, we only need to use the two parameters of metal degree and roughness to have a good effect. There is no need to set the color texture.


If you want a more realistic texture effect, such as the screenshot below, you can add a normal map to the metal and roughness (if you use a map, the data itself must have texture coordinates).


Beautification of white model data

In addition, there are some data, itself is also no texture, subsequent beautification, need to add texture. For example, the effect of making a wall brick on the white mold. In this case, the Json material file used in the beautification process should have a primary color texture, but the data itself must have texture coordinates to have an effect.


Beautification of data with texture itself

Some data itself has texture, and this type of data will not change its texture when beautified. Therefore, the Json material file used does not need to have a primary color texture, just need to have the appropriate metallicity roughness, normal map can be. For example, in chapter 5.3.2.4, the beautification of underground pipeline manhole cover model data is introduced.

Note: The SuperMap Hi-Fi 3D SDK for Unity plug-in and SuperMap iClient3D for WebGL plug-ins used here are only available in version 10.2 and later.