Arranging UVs in straight patterns and using noise to create hair strands for stylized hair

On:

|

,

|

So, this is a little technique I learned from studying one of LeoTheModeler‘s fantastic models. The basic idea is that if you have a noise texture, you can make one of its axes be 0 (or near 0) in scale, which stretches it out. Then if you crank up the detail and scale, you get many parallel lines that look like hair strands. By arranging your hair UVs in blocks that all point in one direction, you can use that noise texture to get fairly convincing hair strands, giving stylized 3D hair a more detailed look.

UV unwrapping

First, you’ll need to UV unwrap all of your hair meshes. Let’s look at DD.

Let’s take a look at the front of DD’s hair.

I created all of these individual locks of hair by using a curves method. See this video for more detailed instructions. The only difference here is that instead of leaving them as curves, I first made their tips have 0 scale so all the points would touch, converted all of them to meshes, and then merged the tips by distance to create triangle caps.

Once it’s a mesh, you can just go into Edge Mode and select the edges where you want to create seams on, then right click and select mark seam. I usually try to make my seams in parts that will be less visible. For example, I can expect the bottom of his hair near his face to be less visible most of the time. Meanwhile, the parts that are further up, the parts that point to the ceiling will be less visible.

Now, let’s head to the UV Editing tab.

Select all of the vertices, and then under UV->Unwrap->Unwrap Minimum Stretch. You’ll get these UV islands.

Hot tip: You can make multiple separate objects occupy the same UV space if you select both, and then enter edit mode in the UV Editing tab. When you unwrap or use the pack islands operators, it’ll try to avoid overlapping them.

Now, you’ll want to arrange these UVs so that the tips are all facing the left side of the UV space. You can do so by just selecting an entire island with L, and then using R to rotate them. However, there is a free addon that makes all of this significantly easier.

Mio3

Mio3 is an incredible free addon for managing UVs, since it lets you transform them in various ways that would otherwise be extremely laborious to do by hand.

For this, we’ll be using the Gridify operator. It will make it so that we get our hair UVs into a grid pattern, which will let us run the stretched out noise texture we’ll make latter through them, giving the appearance of hair strands.

For now, select the UV islands, and use the Align options to get you started on fixing up their orientations. Once the tips are all facing the left side, you’ll move on to Gridify, which will yield various UV islands in a grid format. Select all of them again, and then go to UV->Pack Islands. In this menu, in order to maintain them facing the way we arranged them, turn off the Rotate option but leave Scale on. Also make sure to leave some margin so they avoid overlap. If you do this correctly, you’ll get…

This! With the UVs arranged in this way, we can now do our little noise texture trick.

If you end up getting the tips overlapping with their own islands or other islands, just make sure to use the vertex select mode to drag them out. You will probably need to turn live unwrap off for this, since when you move the vertices, it will probably try to re-unwrap the island.

Creating the noise hair texture

Now, let’s go to the shader editor. For this, you’ll need the following nodes:

  • Noise Texture
  • Mapping (connected to UV)
  • Texture Coordinate
  • Color Ramp
  • Normal
  • Bump
  • Map Range

Let’s first sort out the noise texture. With the Noise Texture selected, press O. That will connect the factor to the Material Output, which will let you see what you’re doing more clearly.

If you connect the noise texture’s factor to the output, you will then be able to go to the material tab on the right, and click Preview. This will let you see what you’re actually doing when you start messing with the Mapping node.

Now, if you scale on the X axis into a very small value, such as 0.01, you’ll create a big sideways stretching effect.

And now, if you click your Color Ramp node, use O to connect to the output, and then bring the color stops closer together, you will see a harsher difference between the dark and light areas.

Hot tip: play with the different modes, like Linear or Ease to get different gradients!

Now if we go back to the noise texture node (but keeping the color ramp connected to the output), we can play with the Scale, Detail, and Roughness values to make the texture more detailed and larger.

Because we have our UVs aligned with the direction the texture is stretching, we get nice, uniform lines running through each tuft of hair!

Adding bump and connecting it to the Principled BSDF node

Now that we have a nice grayscale noise texture that resembles hair strands, we can actually use it for our material. For this, you’ll need:

  • A Principled BSDF node.
  • Our noise setup.
  • The map range, bump, and normal nodes we created earlier.

You’ll need to connect the Color Ramp color output to the Map Range‘s value input, and to the Bump node’s height input.

The Bump node will also need a normal input, which for this case will be just a generic Geometry Normal node, though you can also connect Normal Maps to this input as well. Bump will then connect into the Principled BSDF’s Normal input.

The Map Range node will be used to control Roughness values, which can get you some nice variation on how shiny the hair is.

Principled BSDF connects to the Surface material output. Make sure you pick a color for your hair under Base Color!

Doing so will yield:

This! Now, let’s mess around with the Map Range values.

By changing the To Min value from 0 to 0.25, I increased the floor of the roughness, meaning that the parts that were really shiny before are now a little duller.

When playing around with Roughness values, you gotta always remember: Black=0, White=1, and in Roughness’s case, 0=maximum shiny/reflective, 1=maximum dullness.

You can also play around with the Value on the Color Ramp stops. Something I do sometimes is to make the black stop actually be a dark gray instead. By doing that, you are also bringing the minimum roughness value higher up. For example, if you make it a gray with a Value of 0.3, that will be the same thing as setting the To Min field here to 0.3.

Now let’s look at the final product!

Looking handsome!

Recap

So to recap, what we did here was:

  • We arranged our UVs so that they would all be facing one direction.
  • We made a stretched out noise texture that runs in the same direction as the UVs.
  • We played around with the Noise Texture, Mapping, and Color Ramp nodes to make that noise look like hair strands.
  • We then used that to give our hair Bump and Roughness variation.

This is a really simple and consistent method for creating nice-looking stylized hair. The nice thing about it is that you can mess around with the noise texture a whole bunch to get different looks, such as how thick or thin you want the strands to be, how distorted they should look, how harsh of a transition you should have between light and dark areas, etc. If you want to take it to a game engine and outside of Blender, you’d just have to bake the normal and roughness values to image textures, and you’d be good to go!

Posted by

in

,

One response to “Arranging UVs in straight patterns and using noise to create hair strands for stylized hair”

  1. Ja'aran Avatar

    Awesome!!!!!!

Leave a Reply

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