material

Baby Dragon - Tutorial on Materials and Giveaway!

Hey there! In this tutorial I am going to show you how to get your characters to the next level by making custom materials inside Unreal Engine 4 using Quixel in our texturing workflow. By the end of this tutorial you should be able to create unlimited variations to your characters!

You will learn how to use Material Functions to your advantage and how can you apply them to anything you make.

You can get the project and all the files including the model for free herehttps://gumroad.com/l/lOezd

This is what we will accomplish by the end of this tutorial, unlimited variations for our baby dragon!

First, we need to export our maps from Quixel, I use the UE4 RMA Packaged to get my Base color, Normal and Reflection map which it contains the Roughness, Metallic and Ambient Occlusion.

At this point we are exporting our maps with the colours we may think they work for our character. So we will import an Static Mesh to Unreal Engine to test the model and the maps!

After that, we need to import our maps, we need to take into account that the Reflection map we get form Quixel should be used as a mask (no sRGB) which means no colour correction. This is good for our Base Color maps but we want the exact values for our Roughness, Metalness (which we don't use in this model) and Ambient Occlusion.

We have 3 materials for this little dragon, but we will only work on the body for this example. You can create your basic Material as you would probably do in most cases. You will use the Base color, Reflection and Normal map inputs.

There is nothing from the other world at the moment, many people use this kind of setup for their games and it works really well. We can have our little dragon looking good inside the Engine!

But we have a problem with this kind of Material, what if we want to make different variations for our game? Let's say you don't want to model again another creature, just by changing colours you could tell to the player this is a different creature! So the first thing we want to change just to make our Material more flexible is to modify the normal map.

We've just modified the intensity of our normal map by separating the first 2 channels (red and green) and by multiplying them by an scalar value. After that, we can just use the Append node to combine them again. Let's check how can this dramatically change the look of our model without the need of rebaking the maps or modifying the sculpt!

Now we can change the normal intensity of our dragon! Didn't sculpt hard enough? Don't worry, we can handle it inside UE4. This is a powerful technique so why not save it for everything we make? Lets create a Material Function!

We have just replicated what we made inside the other Material but translated it into a Material Function. Many artists don't know where to start if they want to create functions. The truth is that is easier to create functions from something you already created. Do you think you will do it again? Then create a function! Let's now test inside our Body Material how the function can help us.

We've just made our life easier by eliminating all those nodes and replacing them with a single one. And not just that, need another Material? You can just right click and search for your function! In this case I've created a tag with the name "Unforgiven" so if I type that i get right away what i need.

Let's now change the roughness values of our model!

I've just separated our Mask texture into 3 parts, you can duplicate it by pressing Ctrl + W. Don't get scared, it references the same texture so you are not really increasing the number of textures you can use in your Material, this is just for organization purposes.

There are two things happening here. The first one is that i created a Lerp node to interpolate between 2 values, those will blend with my roughness map (red channel) and create a new MIN and Max value to change the reflections. The second thing is, I've right clicked my node and set it as a Preview to check if what I am doing is going in the right direction, you should always use this feature to test little by little how your Materials are going to work. It's hard to create a big network of nodes without testing it first.

I always forget what is the MIN and Max values and sometimes i want the MIN to be the new Max and the Max to be the new MIN. To solve this I recreated the same setup changing the inputs of A and B in the new Lerp node. Now we only need to create something to let us choose which one we want to use.

Two things are happening here. The first one is that I created an Static Bool Parameter, this allows me to ask myself: "Do i want to invert the roughness values?" If so, it will use the right MIN and MAX values I need. The second is, I used a Switch node. This is the way i can tell the Material which network i want to use and my boolean will decide if it is True or False.

The last thing we need to do is to create an Statich Switch Parameter to decide if we really want to change our roughness values or not, you never know if you will use one feature or another so it's better to think ahead from the start, let's see how this affects our model!

Let's create a Material Instance and apply it to the body material to see the changes in real time. Just right click on the Material you've just created and select Create Material Instance.

The changes are small, but can make a difference depending on your needs. There's nothing more tedious than going into the Painting App again just to change the roughness values if you can do it inside the Engine. Besides, if you want multiple characters you can give them more variation. Now that we've just tested it works, let's create a function so we can use it whenever we want!

Same as before, we are just replicating the old network into a function. Let's see how it looks in our main Material.

Much better! The "Invert Max And MIN is grayed out because we don't always need to invert the values. It would be a waste of time to create a bool each time we want to use this function. So if you need to create them is fine, but otherwise it will still work! Let's now get deeper and change the colours of our little dragon!

The first thing we want to do is to create a way to not give a solid colour to our mesh. So what we will do in this case is to split the 3 different channels of our base color map and multiply them by 3 different colours. Those colours are Vector parameters so we can change their value in the Material Instance, if you hold V you will create them automatically! Let's get into the next step.

 

We have just interpolated 2 different values using the Green channel as a mask. This will make sure we make a nice blending between the two, it will be subtle but it can make your piece stand out.

Now we have just Interpolated the last result we got and the third colour value using the Blue Channel as the Blending Alpha. Now... 3 colours is a little too much, so let's create something to let us decide if we want to use 3 colours or just 2.

We've just used the same technique as before. Created a Boolean to let us decide if we want two colours or the three of them. Then we used our switch parameter to decide which one we want to use!

Finally, we just need to create our Static Switch Parameter to decide if we want to change the colours or not. If It's true we will use the network we've just created, if not we will use our default Base color map we got from Quixel. Let's now test our results!

It works! We changed the colour of our baby dragon completely, but something is wrong here. Everything is just one colour! If i want the shell to be different i wouldn't be able to do it because we are changing all the parts. The good news is that it works, so we can create a function for it so we can use it later.

Same as before, we've just created the same network using a Material Function. At this point you should feel pretty familiar with the workflow. Notice that in order to get our individual channels from our Base color texture I've used the BreakoutFloat3Components node to be able to do that, Its a very useful node!

We now need to find a way to separate the colours from our mesh, for example I want the shell to have a different colour. So we'll use Quixel's features to make this happen.

Quixel allows us to export the masks we create inside it and combining them into their respective channels. Without this feature you would need to combine those mask in Photoshop and create your texture. Luckily for us, we can just select all the masks we want to export and let Quixel do the manual tasks.

We can just select all the layers we want to use (up to 3), right click and select Export Mask(s)

Then we select the destination we want to save the file and we are done! You should end up with a texture looking like this:

In my case I wanted one texture to have the Shell, some Skin areas and other Shell areas to make some differences. The other texture has the tongue, gum and mouth area. I didn't export the body since i could just invert the value inside the Material and get my body texture. Let's now import our texture to UE4!

Like before, we need to turn off sRGB so we can get the exact values of our masks. Now remember the function we create to change the colour of our mesh? Let's make some adjustments to make it only work where we want.

We just added our texture mask and use it as an Alpha to interpolate between the new color and the old one. Let's check if this works with our Material Instance.

It works! We can now change the shell colour. We can now proceed to colour the other parts of the model by repeating the same steps. First I want to add comments to our network, if you take vacations and come back to work later and you want to remember quickly what you did then this is the way to go.

Let's now recreate the same Network, we can just select all nodes and press Ctrl + W to duplicate them with all the connections made. We now need to change the name of the parameters and group them so we can find them in the Material Instance more easily.

To select the body parts, I used the same channel of the Shell and used a OneMinus node to invert the selection. Notice that the function we created is helping us tremendously to stay organized. Now we need to Lerp between the two colours.

Now that we are blending the Shell and the Body, let's check if it works on our Material Instance.

Now we are talking, you could say that we are getting there but we are missing some colour variation. This is were the masks will be useful to avoid losing the quality we got from texturing from Quixel.

Now we are using the Blue Channel to extract the part of the body we want to colour differently. Again, same setup and we are repeating the same step. Let's check how it looks in our model.

Now we can have a different colour on the body of our baby dragon. It's starting to look better! Let's continue to texture the rest of the model.

Now we have some variation on our Shell. Let's check how it looks.

Let's now finish this by completing the rest of the model using the other Mask.

Now we have combined all the colours, It's an easy step but it can get somewhat repetitive. Remember that if something get's repetitive, it's telling you that you can create a function from it. So i will leave it to you as a challenge! You could leave it as it is and create a Master Material for all the characters you want to put in your game, The more functions you have, the easier your life will be and you will be able to finish your games faster!

I hope this will be useful to you and your future projects!

Unforgiven Team

Mauriccio

 

 

 

 

.