Jump to content

Marschner hair model


ssh

Recommended Posts

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
Link to comment
Share on other sites

  • Replies 87
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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. :)

Link to comment
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 ?

Link to comment
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.

Link to comment
Share on other sites

  • 3 months later...

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!

Link to comment
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.

Link to comment
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.

Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...