PBR Materials for Unity


PBR stands for Physically Based Rendering, which means in a nutshell that with the aid of  different texture maps, the engine can simulate the interaction between light and materials with different color, metalness, smoothness and bumpiness. Unity Standard Shader is no exception and can handle rendering most natural and artificial materials.

In this post, I would like to briefly introduce how to merge different maps into one texture file and use it in Unity.


Channel Mapping

Channel mapping is the process when we get two or more grayscale images and pack them together in an RGB image. We can do this in a photo editing application manually, but many texturing tools have these functions built-in and need only a little tweaking.

Most color images you use as textures have 4 channels – Red, Green, Blue and Alpha. The shader can use one, or all of these channels at once for different purposes. We can take advantage of the fact that PBR Materials usually have 2 colored images (Albedo and Normal) and the rest is grayscale (Roughness, Metallic, Height, Opacity). A realistic looking PBR Material can have up to 7 different texture maps, and managing (and later in the game engine, computing with) these maps can be time-consuming.


How to convert a standard PBR Material to use with Unity Standard Shader

Note: I write down the process and the basics. You can find links on the bottom of this article for specific image editing applications.

Albedo: Base Color uses all RGB channels by default. Copy the Opacity (Transparency) mask (if there is any) to Alpha. If you have an Alpha channel, in Unity use one of the non-opaque rendering methods (for example, Cutout) from the dropdown list.

Normal: Unity uses OpenGL format normal maps. If your source texture appears flipped (DirectX format) in Unity, you should edit the Green channel and invert it.

Smoothness/Metallic: Invert your grayscale Roughness map, this will be your Smoothness map. Copy it to the Alpha Channel. Copy the grayscale Metallic map to Red channel.

Height: Uses a single grayscale image in sRGB format. The shader uses only the Green channel, so you can pack it into the Smoothness/Metallic if you need.

Occlusion: a grayscale sRGB format Ambient Occlusion map goes here. If you don’t need a Heightmap, consider packing this texture map into the Green channel of your Smoothness/metallic map.

Emission: Here goes either a black and white mask or a full-color RGB material.

Quick Cheat Sheet for Unity Standard Shader:

Channel Distribution for Unity Standard Shader. Texture names in (brackets) are optional.

Useful Links

Using the Channels Dialog in GIMP

Editing channels with Photoshop

Editing channels with Krita

Thanks for reading, I hope you found it useful!

Header Image Credit: freepbr.com

One thought to “PBR Materials for Unity”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.