Cycles's GSoC 2018 project: new hair shader! Expectations?

Hello everyone,

As you may be aware (if not, please read on!), Google accepted 5 Summer of Code projects for Cycles this year, among them mine, “Implementing a Hair Shader for Cycles”.

My project intends to port Zootopia’s hair shader (doi:10.1111/cgf.12830) to Cycles. There is already a basis available in PBRT’s version, and also a WIP patch by Lukas Stockner that may also be of use.

I’d like to take this opportunity to ask you all about your expectations for the project. In particular, I would like to know:

  • about your use cases for hair (Is the current shader too difficult/easy? Do you need workarounds in certain scenes? and so on)
  • the usability of the current shader (Do you prefer “artist-friendly” controls or physical parameters?)
  • documentation (Do you need more docs than what is currently available in the Blender-Wiki? What would you like to be better covered?)
  • any other feedback, of course, will be appreciated!

As I will need demo scenes later, to test the shader during development, it’d be great if you could point me to available scenes and/or send me some.

Thanks in advance for your answers!

2 Likes

Welcome and good luck with the project!

Of course, we always have many expectations with GSoC projects.
I am just hobbyist with Blender and 3D. Personally I am not worried about the difficulty with configurations while there is good documentation when it is finished. I would be more interested in feature to be very capable and to be able to achieve good realism in how the hair looks and also realism in how it behaves.

Is the project about how hair looks only? Or does it also involve Hair Dynamics?

Tell us when the branch of your project is ready to start testing.

YAFU; When I read the project description, it was generally about accurate hair shading in Cycles (no dynamics involved).

To the student, we can definitely use a cutting edge hair shader in Cycles. What were your plans on how the nodes get done (will it be divided into diffuse/translucent and glossy components like the current system, will there be an option to use a “principled hair shader” like we already have with surfaces and volumes, or something else)?

First off, congratulations for being accepted - and also thanks for taking part of course!
Your proposal surely is one of the more anticipated ones this year. Get ready for lots of love! :wink:

For improvements: It would be cool to have the reflection and transmission control combined.
As it is right now you always have to mix reflection and transmission which seems a bit like unnecessary overhead.
Is that something that comes natural with Chiangs hair shading model ? Unified transmission+reflection ?

Regarding demo scenes there is fishy cat and the gooseberry project to get you set up.

Im sure there will be alot of people providing test cases along the way!

All the best for your GSoC!

Artist friendly controls are always better if we don’t lost advanced controls that physical parameters give us.

Actual shader are in-usable to newbies and standard users.

Oh, ok.

I almost never toy with hair, but I would prefer both; any new shader elements as standalone (such as diffuse and glossy) as well as a principled shader setup which combines everything (such as diffuse and glossy) in the correct fashion automatically (such as fresnel output influenced by roughness, which is not trivial for someone new to even consider). Some of the tricks we see would not be possible if all we had was the principled.

1 Like

Hello,

The following demo files might be helpful to you for testing and comparaison with the movie’s original implementation

Judy Hopps by splatypi : https://www.blendswap.com/blends/view/83856
Nick Wilde by JohnWolffe : https://www.blendswap.com/blends/view/87031

And for human hair :

violet by lucasfalcao : https://www.blendswap.com/blends/view/70479
Simple SSS setup by RicoCilliers : https://www.blendswap.com/blends/view/84082

Like suggested above, a combination of individual nodes and a principled node could be better

Good luck with the project

1 Like

Hello Amyspark, congrats on your GSOC and thanks for your involvement !

That’s a big issue to me, actual documentation describe all the node’s parameters, but don’t explain how to setup a hair shader correctly.

I don’t setup hair shader very often, last time I tried I get something that worked but I’m not sure it’s the best way to use the shaders. I’ve looked at various free tutorial available online and I feel the same way.

Artist-friendly is better to me, maybe having a simple node to setup hair correctly can be good.
And some nodes that you can put together if you know better what you’re doing.
Like with the glass shader that you can re-create with a glossy node and a refraction.

The current shader looks ok to me , but the main issue is the documentation that lacks practical examples.
Are we supposed to mix reflection and transmission, add them, use a fresnel to mix them …
In the end we can get good looking results with trial and error but I can barely see the logical way of setting all this.

Hi all,

We got bit by the migration’s bug, so I’ll recap the missing comments below.

Posted by: CarlG
On: 01-May-18 18:37

I almost never toy with hair, but I would prefer both; any new shader elements as standalone (such as diffuse and glossy) as well as a principled shader setup which combines everything (such as diffuse and glossy) in the correct fashion automatically (such as fresnel output influenced by roughness, which is not trivial for someone new to even consider). Some of the tricks we see would not be possible if all we had was the principled.

Posted by: FXR
On: 01-May-18 19:50

Aside from a good shader, I would love to see an option to “Extrude” hair segments, just like extruding bones to a rig. That would allow a user to "pull out the hair to follow an object surface more closely without intersecting the mesh.

Again, it would a option for regions like forehead bangs and “stray locks” Would be way more advantageous than initially adding extra segments to a hair particle setup. As even with extra segments, you still have to do most adjustments with the five basic segments. requires a lot of rendering and checking to determine look

Posted by: m9105826
On: 01-May-18 20:01

Have a look at the docs for Arnold’s newest hair shader:

https://support.solidangle.com/display/A5AFMUG/Standard+Hair?desktop=true&macroName=center

As far as I’m concerned, they’ve struck the perfect balance between artist friendly and art direction. Cycles’ existing solution had always been confusing because of its manual separation of the R and T terms, leaving artists without the technical know how to their own devices. As a result, I can’t count how many incorrect and non-energy-preserving setups I’ve seen shared throughout the community. Arnold’s devs saw this same issue in their community with their original shader, and I would love to see it addressed with a similar solution on our side.

Posted by: amyspark
On: 01-May-18 21:56

Hey all,

First and foremost: thank you for your comments! It seems that I have a lot to work ahead :smiley:

I’ll reply to everyone below.

—Quote (Originally by m9105826)—
Have a look at the docs for Arnold’s newest hair shader:

https://support.solidangle.com/display/A5AFMUG/Standard+Hair?desktop=true&macroName=center

As far as I’m concerned, they’ve struck the perfect balance between artist friendly and art direction. Cycles’ existing solution had always been confusing because of its manual separation of the R and T terms, leaving artists without the technical know how to their own devices. As a result, I can’t count how many incorrect and non-energy-preserving setups I’ve seen shared throughout the community. Arnold’s devs saw this same issue in their community with their original shader, and I would love to see it addressed with a similar solution on our side.
—End Quote—

I noticed that too when looking up how Cycles’s hair shading was done. I’ll make sure to build the shader along those lines.

—Quote (Origin> ally by rbx775)—
First off, congratulations for being accepted - and also thanks for taking part of course!
Your proposal surely is one of the more anticipated ones this year. Get ready for lots of love! :wink:

For improvements: It would be cool to have the reflection and transmission control combined.
As it is right now you always have to mix reflection and transmission which seems a bit like unnecessary overhead.
Is that something that comes natural with Chiangs hair shading model ? Unified transmission+reflection ?

Regarding demo scenes there is fishy cat and the gooseberry project to get you set up.
https://www.blender.org/download/demo-files/

Im sure there will be alot of people providing test cases along the way!

All the best for your GSoC!
—End Quote—

AFAIK, Chiang’s model is based on d’Eon’s model (doi:10.1111/j.1467-8659.2011.01976.x (http://doi.org/10.1111/j.1467-8659.2011.01976.x)) which combines both (unlike Marschner, which has separate parameters for each mode). There are two key changes, though: the ability to adjust hair so as to simulate the animal hair’s undercoat, and the reparameterization of the underlying distribution’s roughness variables to make them perceptually manageable.

Posted by: zeauro
On: 02-May-18 06:29

  • 1 for a principled hair shader node for easy set-up.
    It should work with attributes of hair info node, UVmapped textures (bitmaps and procedural).
    We may use textures as masks, values. It may be interesting to able to mix some properties of a node.
    So if it makes sense to mix colors of some attributes of such principled hair shader node, it would make sense to have some elemental nodes to produce such blending.
    We just need that to have an artistic control.

It is usual to duplicate same particle system on same area but with an other seed and other children settings to add variations.
So,multiple materials using this shader node in the scene should be supported.
It should work with weird geometry (spiral, braid). Models from Cosmos Laundromat movie should help.

We may sculpt objects and extruded curves to create hair. So, it should also work with models that are not using particles.

I don’t expect more from shading perspective.
The way hair particles geometry should be created has to evolve to become simpler. But it is out of scope and will not happen before end of this GSOC.
As long as, hair can be textured, current geometry is well handled and rendertime is not taking forever : mission would be accomplished.

Posted by: kynu
On: 02-May-18 08:08

—Quote (Originally by m9105826)—
Have a look at the docs for Arnold’s newest hair shader:

https://support.solidangle.com/display/A5AFMUG/Standard+Hair?desktop=true&macroName=center
—End Quote—

This is amazingly well done indeed!

Posted by: julperado
On: 02-May-18 10:13

Congratulations on getting accepted! This is great news :smiley:

I’ve been working with a homemade node group trying to replicate the Arnold hair shader, so a big +1 to m9105826’s suggestion. An artist friendly hair ubershader that also gives enough control to the users would be awesome.

Here’s the file with my nodegroup (https://drive.google.com/file/d/1A795x0H4ytzzLAzYfhnUjD0-YXyMMh2n/view?usp=sharing) and some quick test renders, note that this is just a bunch of mix nodes so it’s probably incorrect and without proper energy conservation, plus it can get longer render times… :confused: but for most cases I’ve been getting good results.

Attachment 522931 (https://blenderartists.org/forum/attachment.php?attachmentid=522931)

I can’t wait to finally have a good hair shader for cycles, thank you in advance and I hope everything goes well with this project! :smiley:

Posted by: rawalanche
On: 02-May-18 10:15

Yes, the Arnold one is a good reference of what a modern hair shader should look like. Corona and V-Ray have also implemented very similar hair materials recently.

Posted by: Geographic
On: 02-May-18 11:14

Well to be honestly, i’m ok width current shader options, what could use some coding love is how to make hair itself.
Some options never really made it, while in general its a bit hard to setup hair (pro’s create groups of hair comb each), while starters rarely do that and get poor results. currently its also a bit trouble some to setup animal fur, if you like to do it realistic. Same for physical hair dymanics… which perhaps touches flesh dynamics as well (muscles)…

For a another hair shader itself i could only say make it work nice width denoiser, and have it in cyclese and eevee.

Posted by: m9105826
On: 02-May-18 15:06

Did anyone asking for hair system features even read the thread? This is a GSoC project to very specifically develop an improved hair shader for Cycles. Everyone who has given it a few hours of their time is fully aware that the hair/particle system in Blender has been running on borrowed time for years now. That’s what the groom system improvements are for. That’s not what this project is about.

@S.Saprophyticus - thanks for the resources!
@sozap - largely along the same lines as the (missing) previous comments.

Everyone - the project is up at https://wiki.blender.org/index.php/User:LeonardoSegovia/GSoC_2018. I’ll post a summary there for reporting purposes later in the day.

2 Likes

thanks for trying to do better, because right now it’s just impossible to make a real character with hair on Blender. Users friendly or not we need documentation to make correct hair. Currently it is impossible to know what the settings are for. All my bald people cry because they can’t have beautiful hair. The current shader is just good for toons but not for real.

Ease of use is always a plus, but not if it means lesser quality, also to have it work in both Cycles and Eevee would be a plus for me, as for many others I am sure!

Good luck on the project, will follow this for sure! :+1:

1 Like

Hey all,

After two weeks of patch porting and bug fixing, I can offer you the first test build of our new hair shader. You can build from my branch, soc-2018-hair-shader, or use the builds below. Thanks to Lukas Stockner, bzztploink and artok on IRC for making them!

Windows x64 - https://graphicall.org/1230 (includes CUDA)
Linux - https://www.dropbox.com/s/cqw28kg39c0y215/blender-2.79-hair-shader-v1-x86_64.tar.bz2?dl=1
MacOS - https://www.dropbox.com/s/d9ugachm1klni3l/blender-soc-2018-hair-shader-macOS-10.9.zip?dl=1

I’m aware that it may fail with certain types of Hair geometry :sweat_smile:. If you manage to find them (it should yield no hair at all or just a ball of black stuff), please send me a demo scene.

I’ve attached a test scene of sorts (a fancy fur ball). I’m sure you can come up with far better stuff! The render below (2048x2048) was made with CUDA on a GTX 1050 Ti in ~2h.

untitled.blend (2.9 MB)

Thank you all for your comments!

3 Likes

Oh, I forgot to tell you how to use the shader :cold_sweat:
The node looks like this:

example_node

There are three (meaningful) color parameterizations available.

  • Direct coloring: just toss your desired color in the Color pin
  • Melanin concentration: if you have the eumelanin/pheomelanin values from a hair color you like, set them in the R and G channels of the Color pin. If it doesn’t work, let me know
  • Absorption coefficients: this bypasses all of the above and directly sets the desired σ.

The remaining parameters are straightforward:

  • Offset: cuticle angle
  • Roughness (longitudinal/azimuthal)
  • Index of reflection

If you read Chiang’s paper, you’ll see that the shader still doesn’t have the “primary reflection roughness” approximation to animal fur undercoat. That’s the next thing in my list :+1:

(tl; dr:) Limitations:

  • Only curve and line segment as primitive for hair render
  • No OSL shader yet
  • No OpenCL (patch incoming later)
1 Like

Great, it seems that the work is going well.

Because I do not know anything about technical data of papers, I thought that with Principled Hair node it would not be necessary a lot of connection of extra nodes to it. I thought that it would be an uber shader with options to be able to directly obtain different types of real hairs, from opaque to very shiny/glossy, even emulating artificial fibers. Also wet hair for example.
Anyway I have no problem with the difficulty as long as at the end of the work you could share in manual node configurations for different common types of hair.

I have done some simple tests. Even with the node used alone, it looks pretty good :slight_smile:

Here’s the Linux build.

1 Like

And here’s an example render to show what the shader can do (keep in mind that I have no artistic talent whatsoever, so someone competent could make it look a lot better):

The hair data is from here.

4 Likes

Cool!
What file format on that site is compatible to import into Blender?
Here a couple of tests, using only Principled Hair node:

2 Likes

I’ve added a quick WIP importer for .mitshair files, it’s actually part of the Linux build. To use it, set up a hair particle system, then select the .mitshair file in the Cycles object properties. It will replace the particle system hair when rendering (doing a Cycles-only importer was much simpler than actually importing into Blender).

1 Like

I’m on linux mint, and when I try and open 2.79-hair… through the gui it takes me to 2.76, and when I try to open through command line, it barfs looking for glibc files…