Making nice hair materials in Unreal Engine

Aug 05, 2022 at 05:00 am by nemirc

Making nice hair materials in Unreal Engine
Making nice hair materials in Unreal Engine

When making a project in Unreal Engine, I will choose between realistic hair and polygon-based hair depending on the situation. For example, in the case of Killer Dolls I am using polygon-based hair because characters on the screen are very small, and you rarely see them in full size. However, a game like Just Let Me Go is different, because the main character is always using a big chunk of the screen, and realistic hair looks better.

While I know a game doesn’t “need” realistic hair, I really like the tech aspect of game development, so I still use it.

To render the hair in Unreal Engine, you can do something as simple as adding color, roughness and a specular value to the hair. However, the result is going to be a very flat-looking hair because it has a very uniform color.

The hair material I am using is more complex, and it’s derived from the hair material example you see in the Unreal Documentation. However, you can see I made a lot of modifications.

First I will focus on the specular part of the hair. You notice I added a specular value to the hair material. I did this to control the specular highlight of the hair, in combination with the hair metalness. These two can make interesting effects for different conditions. For example, if you want the hair to look drier and more damaged, you can use these parameters to make the highlight more diffuse. On the other hand, a healthier hair should have values similar to the ones I have, while wet hair should really ramp up the specular highlight.

Off the top of my head, if you wanted to simulate some sort of “wet hair getting dry” effect (like when your character goes into the water and then comes out), you could use a Blueprint function to change the specular look of the hair, and then gradually make it go back to normal.

The color part of the hair is also slightly different. One big change you can see is how I am using a RemapValueRange node for the Lerp. Basically what I am doing is taking the length of a hair strand (that goes from 1 to 100) and remapping it from 0 to 1. However, you can see my material uses the max value of 25. The reason I did this was because I wanted the transition of the hair colors (having roots of a certain color and tips of a certain color) to happen at one quarter of the hair length. This could also be useful if you are making blond hair and you want the roots to be darker (something that happens in certain blond hairs). As for the Saturate node, it basically makes sure the range remains between 0 and 1, to avoid any weird situations with the Lerp.

Another thing you notice is that I am multiplying the Seed output of the HairAttributes node with the color. This is to add some randomization in hair strand color.

The HairAttributes node is a little hard to understand, so, something you can do is connect the different outputs to the color input in the material node to see the result. For example, you can see that the Seed output actually randomizes the color of the hairstrands between black and white.

Connecting the Length output to the color, while remapping it from 0-100 to 0-1 gives you this result.

And this is what you get when you remap 0-25 to 0-1 like I have done for my hair material.

These extra hair parameters are very useful if you want to use them to add color variations, like what I have done for my character’s hair. Making nice hair materials can greatly improve the overall look of your game.

Sections: Tips + Tutorials

This website uses cookies to ensure you get the best experience possible More Info
Got it!