Validating PBR Materials in UE4

Harrison Eilers talked about the PBR workflow in UE4 for the base color, metallic, and roughness maps, and PBR Validate Tool that helps to test the materials.

Introduction

My name is Harrison Eilers, and I’m an environment and technical artist from Houston, Texas. My passion for game development began at a younger age when I started to mod games like The Lord of the Rings: The Battle for Middle-earth, and Oblivion, though I did not realize it would be a viable career path until I attend summer courses at Savannah College of Art and Design. A year after that, I was accepted into the school where I focused mainly on environment art.

After graduating in June of 2017, I began the arduous journey of finding my first job. In November of that year, I joined the team working on Escalation 1985 as a material and texture artist utilizing mostly Substance Designer. In April of 2018, I worked on an unannounced title as a freelance environment artist with Macktek LLC. And this June, I began working for Brain Zoo Studios as an Unreal Engine technical artist. I work on anything from creating tools and shaders to set dressing and lighting.

When I have free time, I enjoy creating tools in Unreal Engine, Substance Painter or Designer. I have always been drawn to efficiency, and I believe that is why I enjoy the role of a technical artist so much. Currently, I am learning SpeedTree, so that I can familiarize myself with the workflow and find ways to improve the rendering of foliage in the engine.

Physically Based Rendering

Physically Based Rendering (PBR) is a method of shading and rendering that provides a more accurate representation of how light interacts with surfaces. PBR removes the guesswork of certain aspects of material creation, such as specularity, which is based on physically accurate formulas. The materials will also look accurate in all lighting situations, and allow for a consistent workflow for the artist.

In Unreal Engine 4, we use a metallic and roughness workflow. The texture maps specific to this workflow are base color, metallic, and roughness. In UE4, we do not actually have control of the specular values of metallic materials, and for most dielectric materials (non-metallic) a specular value of 0.5 will work. These specular values are hardcoded into the shader for metallic objects and cannot be changed. This minimizes inaccuracies caused by the user, but can also cause frustrations if you want full control over the shader for specific cases.

The base color map dictates the color for the material and when working with PBR in UE4, we have to follow a few rules to ensure this texture is as accurate as possible. One rule is that the base color should not have any lighting information in it. We want this material to render properly in any environment, so if any lighting were to be baked into the base color, it would render incorrectly in different environments. Another rule we must follow is that the base color should not be too dark or too light. Just like in the real world, almost nothing is absolute black or white, so the same must be true to the texture.

  • Base color should be devoid of lighting information
  • Dark values should not be lower than 30 sRGB (tolerant range) or 50 sRGB (strict range)
  • Bright values should not be higher than 240 sRGB

The roughness map describes the surface irregularities that cause light diffusion. In this map, black (0.0) represents a smooth surface and white (1.0) represents a rough surface. Most people would agree that roughness values are where artists have the most room for creativity. That being said, I believe that extreme roughness values are unrealistic, so I have created a simple guideline for myself.

  • Smooth values should not be lower than 0.05
  • Rough values should not be higher than 0.95

Roughness plays a huge role in how materials read. The best possible situation when creating a roughness texture for anything would be to have a real-world reference, something you can hold and see how the light interacts with it. Everything in the real world has very complex roughness, and a very good way to replicate it is to go out and interact with the object or material you are trying to create.

Testing Materials

The best way to monitor and test your materials is to validate them at each stage of your pipeline. If you are creating a material in Substance Designer, there is a node called PBR BaseColor / Metallic Validate so that you can check these values. Also in Substance Painter, Wes McDermott created useful PBR Validate tool. These are things you can test before you ever get into any game engine, to make sure your pipeline is PBR safe.

PBR Validate Tool Breakdown

The tool’s main component is a Post Process Material that is controlled by a Blueprint Actor. Here is a look inside the material.

I’m using the SceneTexture nodes to access specific buffer channels. In this case, I’m using Base Color, Metallic, and Roughness. I then remap specific value ranges to create my validate gradients. I have to convert the sRGB values above to linear using this tool (the first line is sRGB and the third line is linear sRGB). I’m using the remap value material function so that I can get gradients. For example, tolerant to strict low range for Base Color is a yellow to green gradient. Here is a look at the remap material function.

For the Base Color validate, I’m masking out any metallic areas because it only applies to dielectric materials. I rely heavily on IF statements for masking based on values.

For the Roughness validate, I have to create two gradients, the low and high tolerance. Then I make sure that my correct values are all 0,1,0 (Green).

These both get pushed through to the Screen Masking section. In this section, I’m creating my viewmodes by utilizing ScreenPosition UVs so that it can scale to any screen size. For functionality, I also incorporate the Base Color and Roughness buffer channels so the artist can see where they are making their mistakes without turning off the tool each time. After that, I’ve created two simple switches for use in my Blueprint Actor. I then mask out the Skybox and create a master on/off switch for the tool.

The tool would work just fine if I stopped here, but to make it more artist-friendly, I have built a Blueprint Actor to house the post process and material parameters. Here is a look at the Blueprint Construction Graph.

Firstly, I’m creating a Dynamic Material Instance that gives me access to the material parameters inside the Blueprint. I’m then assigning the Dynamic Material Instance to the Post Process Volume I’ve added as a component. I’m then running a sequence to change the Scalar Parameters in my material based off of a custom Enumeration (dropdown list) I have made. Lastly, I have added in a slider that affects the mask.

Harrison Eilers, Environment & Technical Artist

Interview conducted by Kirill Tokarev

If you found this article interesting, below we are listing a few related Unity Store Assets that may be useful for you.

Join discussion

Comments 6

  • Aoris Aoris

    It works for roughness but not for base color. Normalmap is darkening base color in the final reading of the scene texture, so you're really visualizing the base color.
    I thought it was because you're reading base color from lighting instead of GBuffer but changing the scene texture node to BaseColor from GBuffer (tryied DiffuseColor too) doensn't help.
    If you try to tweak your albedo texture or the final base color of your material to get rid of the red parts, you will break everything because the darkening comes from the normalmap, not the material base color, so it only shows where normalmap are "too dark" (from sRGB 30 and sRGB 50 values you chosed)

    0

    Aoris Aoris

    ·2 years ago·
  • Anonymous user

    is this same for specular-glossiness workflow except roughness part?

    0

    Anonymous user

    ·4 years ago·
  • Käy Vriend

    Thanks for adding the hyperlink! Much appreciated.

    0

    Käy Vriend

    ·4 years ago·
  • joshpurple

    Fantastic!  Very impressive, & Thank You :) !

    0

    joshpurple

    ·4 years ago·
  • Ben

    AWESOME!

    0

    Ben

    ·4 years ago·
  • Käy Vriend

    Would love to see hyperlinks for Escalation 1985 in the article.

    0

    Käy Vriend

    ·4 years ago·

You might also like

We need your consent

We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more