Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

ssh

Marschner hair model

88 posts in this topic

Hello,

Just would like to share hair shader I've done.

This shader implements well known Marschner model proposed here:

http://www.graphics....r-sg03final.pdf

Video on Vimeo:

http://vimeo.com/18197441

Youtube:

Tested both in H10 and H11.

post-4029-129347145294_thumb.jpg

post-4029-129347134752_thumb.jpg

Shader Parameters:

Diffuse color and intensity.

please note that for dark hair diffuse intensity is usually very small

Overall specular intensity and color. Computed speculars are multiplied with this values.

This parameters are not physically correct and are provided for convinience only.

Different light masks and categories lets specify which lights are contributing to diffuse and specular computation.

Specular components:

Primary Highlight (R ): Strong primary specular peak.

Secondary Highlight (TRT): Colored secondary peak.

Backlight (TT): Colored component that appears in back lighting situations. That is the bright halo around the hair.

Each component has it's own intensity and color multipliers for ease of use and tuning.

Shift sets shift amount of speculars from root to tip.

Width sets width of speculars. The more the width the wider they are.

Usage:

1. Download and Install ssh_marschner_hair.otl (File->Install Digital Asset Library)

2. In SHOP context start typing ssh_marschner_hair_model and choose this shader.

Update: There are hairDiffuseExport and hairSpecularExport export variables so diffuse and specular data may be separated.

UPDATE:

Shader supports texture maps as well as ramps that allows to remap colors and opacity from root to tip.

Latest version of the shader is avaliable here:

ssh_marschner_hair

ssh_marschner_hair.otl

Edited by ssh

Share this post


Link to post
Share on other sites

That's very cool, thanks for sharing Sergey!

M

Share this post


Link to post
Share on other sites

Your results look nice and stable! Thank you very much for this lovely christmas gift. I do hope you can one day share the source code with us :)

Share this post


Link to post
Share on other sites

Thank you guys!

I'm greatly appreciate your feedback!

Was it hard to implement ?

Not very hard. It's not rocket science. :)

I do hope you can one day share the source code with us :)

Yes, why not. I'll think about it. :)

Share this post


Link to post
Share on other sites
Not very hard. It's not rocket science. :)

That's right. But the shader is pretty huge, I've only done some simple ones. How do you start something like that ? Build first some of the modules indipendently and see that their contribution to the ouput looks correct or what ?

Share this post


Link to post
Share on other sites

How do you start something like that ? Build first some of the modules indipendently and see that their contribution to the ouput looks correct or what ?

Yes, something like this.

I definitely had to read this paper several times before understand anything.

Next, I figured out that there are simple things and there are complicated ones.

For example, compute R component is relatively very simple and computing TRT is much more complicated.

So, starting with simple ones, get proper results and then getting into more complex stuff. :)

If you have any questions - please ask.

Share this post


Link to post
Share on other sites

Forgot to mention: there are hairDiffuseExport and hairSpecularExport export variables so diffuse and specular data may be separated.

Share this post


Link to post
Share on other sites

It's great that you posted this Sergey, I've started using Marschner model at my work recently and I feel it lights more naturally than Kajiya. I find the biggest difference to be in the way it responds to rim lights... I haven't played around with your implementation, but I'm glad you pursued this effort and shared your results! :)

I believe at last year's SIGGRAPH there was a paper (can't find it unfortunately) that presented a simplified set of shader controls for the Marschner model, much more aritst friendly and easier to digest. Just FYI, in case you can find the paper and feel it's useful.

cheers!

Share this post


Link to post
Share on other sites

Thanks!

Probably you are talking about this paper: %20An%20Artist%20Friendly%20Hair%20Shading%20System.pdf"]An Artist Friendly Hair Shading System

It's from Siggraph 2010 and I've took some ideas from it.

There is another great paper about hair: %20Efficient%20Implementation%20of%20the%20Dual%20Scattering%20Model%20in%20RenderMan.pdf"]Efficient Implementation of the Dual Scattering Model in RenderMan

I wish I had time to implement it.

Share this post


Link to post
Share on other sites

thanks Sergey, but for some reason the shader doesnt appear to be working for me. :/

I had a look in the code part of the shader(From the Type Properties) and it had one line,

ÀÜ):

Don't know if thats to be expected.

Share this post


Link to post
Share on other sites

Would you please refine how it's not working?

The result is all black, the result is all white?

Hair is disappearing?

If it's all white maybe the lights are very strong.

Please try lowering primary highlight's weight to values like 0.2 for example.

Also setting primary highlight's width to values like 2 might help.

If this does not helps would you please post your scene?

Edited by ssh

Share this post


Link to post
Share on other sites

Yep i got it working now. The settings you mentioned helped. Also increasing the diffuse intensity.

Are there plans to allow maps to control color & spec attributes.

Its very nice. :) Thanks for sharing this great work.

Share this post


Link to post
Share on other sites

Thanks, glad it's useful for you!

Definitely I'll add texture and ramps controls as soon as I get some time.

Edited by ssh

Share this post


Link to post
Share on other sites

Very cool sir.

For now, its time to play :).

Am i right in thinking this was written for the micropolygon renderer? If there is a way do i need to do something special to get it to work with pbr?

Either way its very very cool.

Edited by phrenzy84

Share this post


Link to post
Share on other sites

Well, I think currently it will not work with pbr engine.

As far as I understand from docs, currently it's not possible to create your own scattering function from scratch.

From docs:

"You don’t write the scattering function yourself. You create BSDFs by combining primitive BSDFs using addition, multiplication, and scalar multiplication."

It's here: http://www.sidefx.com/docs/houdini11.0/vex/pbr

Also, found this on SESI forum:

"Currently its not possible to create BSDFs on your own, either via VEX or the HDK. There has been talk that in future versions of Houdini this may be possible but the VEX language itself would need to be improved in order to facilitate this."

Creating BDSF for PBR

So, looks like we have to wait for the next versions.

However, shader works with micropolygon and raytrace engines. :)

Edited by ssh

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now