Wednesday, 8 October 2014

About textures and materials (Part 1)

You should know right now that Unreal Engine 4 does use a new physical based shader for their materials and to use it properly you should make some additional textures.

Also as a basis you should make your textures as big as possible and then size them down to a proper resolution like 2048*2048 px.
Keep in mind that both height and width must be a power of 2 but it doesn't have to be square so you may do a 512*2048 px texture for the trunk of a tree for example.

First off, you will need a nice color or diffuse map. This is pretty self-explanatory, but this is mainly the color of your asset. If your assets are going to be plain single colored, then I suggest to don't waste a whole texture just to make it. You can assign color vectors to the diffuse channel.

Color texture
A color or diffuse map
Also you may want an Ambient Occlusion map (also known as AO) which may be baked within Maya or 3D Max, or using a wonderful app called xNormal. This can be used to overlay subtlety onto the color texture and/or store it in a texture to mix it later in the UE4 material editor.
Since the AO is a greyscale texture, I usually pack it in the alpha channel of my color texture and then save it as a single 32 bit .TGA file.

Ambient Occlusion Texture
An ambient occlusion map
Since the launch of DirectX 9.0, the use of normal maps has been almost a must have in any videogame. These are usually blueish textures which contains information about a highpoly model stored in the RGB channels.
There are several ways to generate,bake or paint theses textures. You may do a bake of highpoly model done in Zbrush to a lowpoly one using xNormal, or if you already have a nice color texture you may try programs like Crazybump or Pixplant, or the Nvidia Plugin for Photoshop
Usually, I try to mix the result of both techniques in Photoshop to achieve a nice result aimed for UE4.
Normal map texture
A normal map made with Crazybump
The specular map is usually a grayscale texture which defines the shinning and reflection of non-metallic stuff. If your asset is made of a single type of material (ie: a wooden table, a rocky wall..) you may leave it and use a constant value in the material editor. Take note that even the roughest material should have some specular so, avoid full black textures.
Working alongside the specular map, you now have the roughness map which tell us how rough a material is. A rough material will scatter reflected light in more directions than a smooth material.
This is also a greyscale texture and as it happens with the specular, you may use a single constant value instead of a whole texture in the material editor.

Then you have the metallicness channel in UE4, which was introduced to make better metallic materials. I use this mostly as a mask when having both metallic and non-metallic parts in a single material.

When packing theses 3 last maps and since they are grayscale maps, you can use a single 24 bits .TGA to store specular, roughness and metallicness in the texture RGB channels. The result should be a texture with pretty funny colors.

Mask merging
Specular, Metallicness and Roughness, stored respectively in the Red, Green and Blue channels
And that's it for now. In upcoming blog entries a will talk about other maps such as emissive and displacement, and as well how I do set up my materials in Unreal.


Post a Comment