Anyhow, ONWARD! One problem with PBR is that there are two very prominent workflows for it, which are both very similar, and very different. Unreal Engine 4 depends on what is called a “metalness” workflow, and engines like CryEngine and Unity 5 depend on a “Specular/Roughness” workflow. Both are very simple, and lucky for us, pretty fun to actually teach. I’m not going to get in to the differences between the two work flows here, because there are many (but only a few that we really care about, for now) – if you’re curious at all about them see the link I posted above. It will enlighten you to both. So, since we’re going to be learning to use one of our materials in UE4, we need to really pay attention to the Metalness Workflow.
Our materials, in contrast are all made using the Specular / Roughness workflow, so our goal in UE4 is to merge the two methods, and come up with a solution which allows our materials to shine beautifully inside of UE4. Lets talk about some of the major differences between the Specular / Roughness and Metalness workflow that I eluded to above. So, the biggest differences are that in Metalness workflow a metallic material takes its specular color from the base material, and in roughness/ specular workflow the metal takes its color from the specular texture, and the second biggest difference is that the roughness texture (or, if you’re using our textures, the _g) texture needs to be taken out of sRGB mode, and inverted. With that in mind, our goal for metallic materials is to transfer the physically correct metallic color from our specular texture, and layer it on top of our Albedo texture that we supply, then we need to tweak the gloss map to match the requirements of UE4’s rendering. Pretty simple! So, the material we’re going to be working with in this tutorial is this guy:
Download It for Free
Because how else can you follow along, silly?Click Me!
Now we’re in bidness. 3 Make sure you save that in the top left corner, then head back to your content browser. Time to create a material! Right click anywhere in the folder your textures are, and click Create material.
4 Name your material something relevant, I named mine “concrete_RebarConcrete” to match the wonderful redundant file name. Once it is named, double click that and open the material browser. Time for the fun part!
5 Drag and drop the Albedo image, the Normal Map, the Mask File, and the Roughness texture in to the material editor.
6 So, as I mentioned above, the first thing we have to do to make this material work in UE4 is to modify the albedo image to work in UE4. So, holding L click anywhere on the workspace to create a LERP. LERP stands for Linear Interpolation, think of it like a layer in Photoshop. The A input is the base texture, the B input is what we want to overlay, and the Alpha input is the mask we will use to overlay B over A. It’s confusing, I know, but you’ll get used to it fast.
7 Holding your “3” key on your keyboard, click anywhere on the workspace to create a “Constant 3” node, this is just a basic RGB color picker node. It’s going to let us pick a solid color, in this case, we’re going to use it to pick a physically correct metal color.
8 Make your workspace look like mine by connecting inputs.
I have made my Constant 3 a very bright pink so you can more easily see the effect it is having on our final material. The pink color is now overlayed on the albedo texture we started with, which is exactly what we want. This material is almost ready!
9 Grab the Blue channel of our Mask file, and plug it directly in to our Metallic input on the main material. That’s going to make that section represented by blue render as metal. The reason we’re not using the Red channel is because Rust is outside of the metallic spectrum, so technically UE4 does not need to render it as a metal.
10 Let’s change that pink color to a physically correct steel color. I’m going to turn it to just .845, .845, .845. If you want, you can switch this out with a constant 1 node, by holding your “1” key and clicking on the workspace, and then you can simply just set this to .845 (or around there) and plug it back in to the B input of your LERP. This is optional, though.
11 Moving on to the Gloss Map, since it’s already in the right color scale, all we have to do now is invert it, then increase its contrast a bit to give a bit of the detail back to it. Hold down the “o” key, and click on the workspace. This is going to create a 1-x node, which is a simple linear invert node. Plug your gloss map in to that, and plug it in to the Roughness input. Nice. This is definitely making some progress. I’m not super happy with the roughness still, I think the concrete is far too “rough” and the metal parts are not smooth enough. So, lets increase its contrast.
12 On the right side of your Material Editor, in the Palette, do a search for a “Power” node, drag and drop it on to the workspace.
13 Holding the 1 key, create a constant 1 node, and plug that in to the “exp” input of your new Power node. This is an exponent, think of this Power node as a node that is just multiplying our texture by itself. Plug the 1-x node in to the “base” input of our power node, and then plug the power node in to our Roughness input of our material.
14 Double click that Constant 1 node you just created to open it, and change it to a value of 3. This is literally just making the node be our texture to the power of 3.
Press the Green Apply button to save it, and check it out in game! There you have it! That’s how you set up our materials in UE4. I’m going to do a part two of this explaining the Height Map, tessellation, and setting up a more robust control scheme for our roughness, but for now this is the most basic way to use our materials in UE4. Make sure if you have any questions you hit the comments! Thanks, and I hope this helps!