Plug-n-Play Natural Hair Material

UPDATE: New .blend with more complete material attached to this post.
info on post #7

So I was doing some research for my Irina project on hair color, when I came across this research paper by Weta Digital
In chapter 6.1, they discuss color as a function of the amount of melanin in the hair. After some additional research on the interwebs, I figured out how to translate it into Cycles.

It’s dead simple: A 0 - 1 range will give you all natural hair colors. You can also include a dye color, which mixes with the hair color in a realistic way.

Enjoy! By the way, excuse the rest of the shader. It’s a work in progress. So is the hair.

hair.blend (1.42 MB)


really nice. I love it

1 Like

Really interesting! What about red/ginger hair? Im guessing that would be done by dye?
would it be possible to have a ~salt and pepper effect? varying melanin per strand with a percentage ratio?
could dye be driven by a colour ramp from root to tip with variance?

Thanks guys!

Michael W, red hair is possible without dye. On that research paper there’s a gradient showing all the colors the equation generates and it’s not linear. Red is a very small band of color. It also helps to lower the Primary Spec mix as it washes out color.

Red Hair

As for color variation I thought about adding that in, but if you think about it, all the equation does is take in a number and spit out a color. With that in mind, you can mix two of these nodes as you would any two RGB values the traditional way.

Salt-N-Pepa | PUDDIN’ (Note there is a second mix for the Primary Spec inversion)

I might work on a comprehensive hair shader that includes all this for easy mixing, and doesn’t require much tinkering with spec values. I’ll need to digest more of the Weta and other research papers first.

This is bad @$$.

Nice stuff!
Since the resulting outputs are plain RGB and 0-1 range, I made a ramp version for those who like to save processors from all that math!

Thanks fellas!
lsscpp, that’s a cool idea. Didn’t think of that. I usually just expect my computer to work hard and die young. :smiley:

I did put together a more well rounded material incorporating the melanin color. I attached it to the first post. (There’s a lot more math here, lsscpp!)
I spent a bit of time playing around with the Marschner model to get a better sense of the relationship of the various parts. With that, I renamed the controls based on their effect in an attempt to make it more artist friendly. There’s a full explanation in the blend.

I also updated the display model. I realized that the original kinda looked like a turd. haha So I set off to make a new, simple mesh to grow hair out of. A couple hours and beers later, I ended up making something way more complex than it needed to be. Why not. Who doesn’t like a robot/helmet thing with hair growing out of it.


Now, that is highly interesting. Thanks for the nodes and thanks also for linking the paper. I will have to do some reading soon. :slight_smile:

You are most welcome.

And guys, critique is welcome and encouraged! With every project I work on, I try to develop at least one new tool or workflow to make things easier on my next project. I share with the community if I think others will find it useful, but something that works perfectly for my specific project might have hidden pitfalls on another.

So if you have any improvements or ideas in mind like Michael W, and lsscpp have mentioned, by all means let’s have a discussion about it. I believe in tools created in open source software being just as community driven as the very software it was created in. :slight_smile:

@cgCody i tried changing the values of this new (hair.blend) one you modified using ramp. other things seem to work fine except for the color value connected to the 2nd color node doesn’t seem to work fine for me (does not change the color of the hair), i don’t know why. Is there something am not doing right?

Nice work! I was thinking the same after seeing this Arnold AlHair shader, but haven’t had enough time to try to replicate it (Also, I’m not that good at math hehe)

Check it out, maybe you can get some ideas from it too :slight_smile:

Edit:
Here’s a video explaining how to use the shader.

Hi Chukx_007. Where are you trying to change the 2nd color? The 0-1 color parameter, the hair dye parameter, or on the ramp itself?

julperado, I know what you mean. I’m no mathematician myself. Most of the stuff in those research papers is Greek to me (literally… all those Greek symbols used in math notation! haha) Let’s just say a lot of luck goes into the process.
I took a quick glance at the link, it looks like they used the same paper. I like the melanin randomize feature. There’s some other good stuff in there. I’ll definitely take a look at the video when I have some more time.

It looks nice, Cody. Good work! And thanks for sharing with us.:yes:

the 0-1 color parameter linked to the 2nd color node

Interesting. Well there are only a few things it could be that I can think of. If you have the translucency or silver parameter at maximum, it will override all color. If you’ve made a change to the nodes plugged into 2nd Fac, note that this is telling the shader where to put the 2nd Color. Lastly, if you’re using the strand primitive, you can’t use UVs to drive the color placement.

If none of those are the ticket, feel free to upload the blend with the changes you made and I’ll take a look.

thanks a lot let me try it out. :slight_smile:

Nice! I made a similar one pretty recently based off the same paper (I made some edits on the controls, so that it’s more intuitive). Mine’s controlled using darkness, redness, saturation, and glossiness sliders. I also have an optional dye color (white means no dye).

Examples:




very cool, thanks for sharing

thanks for this shader, after a lot of issue grooming the hair of this character, it was easy to just append it and tweak it to obtain my desired result. :smiley: