Texture Conversion in Gem RTS
Introduction
Texture conversion is necessary for transforming texture sets created for Phong materials into material components. In the Gem RTS engine, the conversion process can be performed automatically using material schemes created in the Scheme Editor.
Differences between texture components for Phong and PBR materials
Phong material components
The
lightmap
is baked into thediffuse
texture map, located in a separate upper layer of the original.tif
file and overlaid on the color map using the Multiply Blend mode.Specular
texture map is used to define the shininess and reflectivity of surfaces..
PBR material components:
The
diffuse
texture retains only the material color, while thelightmap
is transferred to a separateambient occlusion
texture.Metallic
androughness
texture maps are used to simulate how light interacts with surfaces in a realistic way
Texture conversion using the Scheme Editor
Using conversion blocks in the Scheme Editor, you can create material schemes that automatically convert Phong texture sets into PBR materials during rendering.
The conversion works by transforming Phong texture sets (diffuse and specular) into PBR components diffuse, metallic, roughness, and ambient occlusion. The generation of PBR materials from Phong texture sets is based on the following assumptions:
Component | Conversion assumption |
---|---|
Metallic | A high |
Roughness | The higher the specular value, the smoother and more reflective the material.
The minimum specular brightness value is taken into account to avoid very smooth surfaces. The original scheme's |
Ambient Occlusion |
|
Conversion Blocks
Conversion Block Name | Input Pin | Output Pins |
---|---|---|
Specular to metallic and roughness | specular |
|
Diffuse to ambient occlusion | diffuse with baked lightmap |
|
Creating a Scheme for automatic conversion of Phong texture sets to PBR material
Launch the Scheme Editor.
Open the Phong material scheme.
Add Conversion blocks to the scheme.
Connect the Phong
diffuse
andspecular
textures to the input pins of the Conversion blocks.Combine all data from the output pins of the Conversion blocks into the Material block with the chosen lighting method.
Save the scheme to the
/gem2
folder.
Example of using conversion blocks in the bump material scheme from the gem2 folder
New PBR material schemes can be created using the Scheme Editor.
Methods of Converting Phong Textures to PBR
Automatic Conversion
Using conversion blocks in the material scheme, Phong texture sets (diffuse, specular) are transformed into PBR material components (diffuse, ambient occlusion, metallic, roughness) automatically during rendering.
Partially-Automatic Conversion
Extract the lightmap from the diffuse texture and save it as a separate ambient occlusion texture using a graphic editor.
The specular map is converted into metallic and roughness components using a conversion block in the material scheme.
Conversion using a graphic editor
Steps:
Transfer the
lightmap
from the Phongdiffuse
texture to a separateambient occlusion
texture.Convert the Phong
specular
texture to aroughness
texture map. Usually, inverting thespecular
image and adjusting it with levels is sufficient.Create a
metallic
map based on the Phongspecular
texture, leaving the brightest areas white (metallic = 1).Assemble the PBR material scheme in the Scheme Editor using the PBR material texture maps.
Assigning the PBR material scheme to a model
When creating new models, it is recommended to assign materials from the pbr/
folder.
Material schemes from the gem2/
folder support the automatic conversion of Phong texture sets to PBR material during rendering.
Re-exporting the model
In 3D Max, assign the PBR material scheme to the model.
Export the model to the game using the 3D Max Plugin. During export, the .material file in the model folder is automatically updated to include the material scheme and the paths to the textures for the material components.
Without Re-exporting the model
Open the
.material
file from the model folder using a text editor.Replace the material scheme name and paths to the corresponding PBR textures (textures must be in
.dds
format).
Last updated