Using GameTextures in Unreal Engine 4

blogHeader1
 PBR workflows are tricky, confusing, and most of all very, very scary. The only reason we’ve become any good at them is because we’ve made 900 some odd PBR materials in the past six months, and it’s become a bit of a second nature to us at this point, which is lucky for you, because now you don’t have to wonder about how you use our materials in UE4 any longer. Huzzah!  So, as you may or may not know, the term PBR refers to the newest, fanciest method of rendering that all of the cool game engines are switching to. PBR Stands for “Physically Based Rendering”. Don’t freak out, you didn’t need to pass your high-school physics class (or, in my case somehow, ever even take a physics class..). All this means is that we have a sorta-strict rule set to follow when we create these textures which will allow game engines to render them as close to their real-world counterparts as accurately as possible. It’s really awesome, so, using measured refractive index values of surfaces, and then converting them in to sRGB values we can very accurately recreate beautiful materials that we see in our every day life. If you want to read a bit more I highly, highly recommend Joe Wilson’s post over on the Marmoset.co blog.

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: 3DPreview  

Download It for Free

Because how else can you follow along, silly?

Click Me!
  Download that baby, and un-rar it anywhere you want. In Unreal Engine, create a new directory, then drag-drop all of our texture files you just unzipped in to that directory.    Before we start actually building the material we need to take a few steps to make sure Unreal Engine is using our assets properly.  So, we need to double click our _G map (Gloss, or roughness), and change a quick setting. Untick the little sRGB box, UE4 automatically imports this as sRGB, but it isn’t necessary to use that color mode with the roughness texture. Click save in the top left corner. 02   Double click the Normal Map file, we need to flip the Green Channel on it to put it in the proper color mode for UE4. In the texture window scroll down and tick the option “Flip Green Channel”. 03

 

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.

 

01

 

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.

 

04

 

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.

 

 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.

 

 Make your workspace look like mine by connecting inputs.

 

 

05

 

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!

 

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. 06     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.

 

07

 

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!

Part 2 is available here!

 

 

Share Away

8 Comments on “Using GameTextures in Unreal Engine 4”

  1. Westin Prescot

    thank you for posting this. your website has been a complete lifesaver for me during my game design school, and this really answers a few questions i had. Keep it Up!

  2. Ryan Halliday

    Hey guys, thanks for the great post. This is really useful, we had been using them mostly correctly, but turning off sRGB in the gloss map is great insight. That really helps make these easier to use, also, before this we had just been multiplying the gloss map by itself (as both A and B inputs of a multiply node) to increase contrast, the power node is a much more simple way to do that.

    Can you do a tutorial on how you set up the materials in your unreal marketplace demonstration materials? I can’t seem to wrap my mind around it. Thanks!

  3. Grant Egglestone

    Excellent tutorial, I wasn’t using a lot of the textures correctly at all.

    I agree with Ryan above, an advanced tutorial covering some of the more complicated materials from your free pack on the marketplace would be great!

  4. Pingback: Using GameTextures in Unreal Engine 4 | Blog @ GameTextures | timcoleman3d

  5. Jeff

    This tutorial is great but there are a lot of other textures on this site that have much more to it like the:
    _T Transparency maps
    _H Height maps
    _E emissive maps
    _D diffuse maps
    …and etc.

    It would be great to see a tutorial going over the basics on how to use all of these different maps together in Unreal Engine so that the users can use these textures to their fullest potential.

  6. William Hamilton

    Is the rar file still available for download somewhere? I tried clicking the download link at the top of the page and it said it “Oops! That page can’t be found”.

  7. Kenny

    Hi,

    Has this workflow changed in the past 2 years at all? I can’t find anything more recent and I’m struggling to get my PBRs to look right.

    I read somewhere that you need a reflection capture actor in the scene for materials to look right is this correct?

    Cheers

Leave a Reply

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