Jump to content


Hair revisited


  • Please log in to reply
218 replies to this topic

#1 Marc

Marc

    odforce ninja : NVTS

  • Administrators
  • 4,044 posts
  • Joined: 25-June 01
  • Location:R&H - Vancouver
  • Name:Marc Horsfield

Posted 17 September 2004 - 02:00 PM

First off, I would like t osay that Mario, you rock!

I was sitting here trying to think how I would render some hair when I found an old post of yours where you helped someone render their ri_curve as a tube.

Taking what you did (thank you, thank you)... I modified the lighting model to Oren-Nayar and here is the result :

image1 : default hair shader.    image2 Mario's tube shader.
bad_hair.jpg     good_hair.jpg

Do you mind if I package it up and put it on the codex? As an improved hair shader?

Thanks
M

oh P.S. If anyone has any idea on where to start for a skin/fur shader for this guy, I'd be mighty appreciative.
"I am mighty! I have a glow you cannot see. I have a heart as big as the moon, as warm as bathwater. We're superheroes, man! We don't have time to be charming! The boots of evil were made for walking. We're watching the big picture, friend. We know the score. We are a public service, not glamour boys! Not captains of industry! Not makers of things! Keep your vulgar moneys! We are a justice sandwich, no toppings necessary!

#2 thekenny

thekenny

    Illusionist

  • Members
  • PipPipPip
  • 367 posts
  • Joined: 16-August 02
  • Name:the kenny

Posted 17 September 2004 - 03:24 PM

Marc, on Sep 17 2004, 02:00 PM, said:

oh P.S. If anyone has any idea on where to start for a skin/fur shader for this guy, I'd be mighty appreciative.

i'd get hit by a bus [accidental like]

;)

there's a nice paper from 2004 about density lookups,
just make sure it is antialiased correctly.
-k

#3 Mario Marengo

Mario Marengo

    Grand Master

  • Members
  • PipPipPipPipPip
  • 1,249 posts
  • Joined: 26-June 02
  • Location:Toronto, Canada
  • Name:Mario Marengo

Posted 17 September 2004 - 08:26 PM

Hehehe... well; I'm happy to hear that I've helped without even knowing it :P
But before you go putting it in the codex, do you mind if I have a look? -- 'cause I can't for the life of me remember what post you might be talking about  :unsure:

There is an old Renderman "Thin-tube" fur-like shader that was one of the application notes for quite a few years now. And my next little private project was to try to implement Jensen's  pull-out-all-the-stops 2003 Siggraph paper version -- much better looking than the now classic Kajiya model...

I'm just curious to see what the heck I was smoking that day ;)

@thekenny:
At the risk of endangering someone's life at the hands of a large utility vehicle... can you at least say whether it was a siggraph paper or not, and whether it was relating to hair/fur, or to the skin part of the question? :P

One paper from the sig2004 proceedings that has got me really excited is the one on Shell Texture Functions... very cool stuff. Now all I need is time!... <_<

Cheers.
Mario.

#4 Marc

Marc

    odforce ninja : NVTS

  • Administrators
  • 4,044 posts
  • Joined: 25-June 01
  • Location:R&H - Vancouver
  • Name:Marc Horsfield

Posted 18 September 2004 - 06:49 AM

Nice interesting papers. It's time like these that I wish I understood more than just the pretty pictures  :P .

Here's the thread : curves

Perhaps it shouldn't go up just yet :). I was just so excited yesterday that I actually got something better than the default hair shader.

M
"I am mighty! I have a glow you cannot see. I have a heart as big as the moon, as warm as bathwater. We're superheroes, man! We don't have time to be charming! The boots of evil were made for walking. We're watching the big picture, friend. We know the score. We are a public service, not glamour boys! Not captains of industry! Not makers of things! Keep your vulgar moneys! We are a justice sandwich, no toppings necessary!

#5 Mario Marengo

Mario Marengo

    Grand Master

  • Members
  • PipPipPipPipPip
  • 1,249 posts
  • Joined: 26-June 02
  • Location:Toronto, Canada
  • Name:Mario Marengo

Posted 19 September 2004 - 06:16 PM

Ah; I just saw the old post...
Oooooo.... nasssty little trick, that! :whistling:

That shader doesn't even try to antialias the illumination. Instead, it fades the parametric surface coordinate s to the center position (in this case zero) as the ratio of the curve-width to the filter-size shrinks. Yikes... straight from the "l33t h@x0r sh4d1n9 mAnUa1", chapter 666.


It works... but only because illumination changes pretty gradually, and so you don't usually pick up the hack.... oh well... it is better than doing nothing at all, though :P

Anyway. There's also a lot of extraneous (read unnecessary) stuff in there that had to do with showing how to derive a height for displacement. The actual guts of computing the normal is just two lines of code (which I had also posted to the wiki here).

I threw together a quick VOP that you can use to produce this (mysteriously antialiased ;) ) normal, so you can then feed it to whatever lighting model you care to invent for your hair (OrenNayar or whatever).


Cheers!

Here's a VOP that calcs the magical normal Attached File  RiTube.zip   1.48K   648 downloads
Mario.

#6 thekenny

thekenny

    Illusionist

  • Members
  • PipPipPip
  • 367 posts
  • Joined: 16-August 02
  • Name:the kenny

Posted 20 September 2004 - 12:04 PM

the was a sketch this year about using a density lookup for hair. seems interesting.

I found this oldish link as well for you and yours.
http://www.185vfx.co...oursenotes.html

I like the paper you pointed out as well.
Very interesting.
I have to admit, I have a lot to learn when it comes to shading, but I'm trying my darnest to keep up:)
-k

#7 Marc

Marc

    odforce ninja : NVTS

  • Administrators
  • 4,044 posts
  • Joined: 25-June 01
  • Location:R&H - Vancouver
  • Name:Marc Horsfield

Posted 20 September 2004 - 02:33 PM

Thanks Mario, this one works nicely.. pretty simple too :).

@kenny : I'd dug up that paper already, its pretty cool. A lot of the stuff may be a little on the overkill side for what I'm trying to achieve though ;).
But definitely a nice guide on what to look out for.

Besides, I never think of horses as fluffy.. They're more sleek and shiny, so I may get away with texture mapping combined with a nice shader for the specular and whatnot.
I have no idea, and I'm not very good at these things. But I've got nothing but time right now.. so I may as well play around :)

Ciao
M
"I am mighty! I have a glow you cannot see. I have a heart as big as the moon, as warm as bathwater. We're superheroes, man! We don't have time to be charming! The boots of evil were made for walking. We're watching the big picture, friend. We know the score. We are a public service, not glamour boys! Not captains of industry! Not makers of things! Keep your vulgar moneys! We are a justice sandwich, no toppings necessary!

#8 edward

edward

    Grand Master

  • Members
  • PipPipPipPipPip
  • 3,339 posts
  • Joined: 10-September 02
  • Name:e.d.w.a.r.d. .

Posted 20 September 2004 - 06:46 PM

For horses, perhaps Kajiya's original paper might work well. Off of google:
http://www.stanford....cs348b/results/

Something for i3d?

Opacity shadow maps might also be an inspiration:
http://graphics.usc....taeyong/osm.htm
don't panic!

#9 Mario Marengo

Mario Marengo

    Grand Master

  • Members
  • PipPipPipPipPip
  • 1,249 posts
  • Joined: 26-June 02
  • Location:Toronto, Canada
  • Name:Mario Marengo

Posted 20 September 2004 - 09:44 PM

Thanks for the paper references, Kenny and Edward! :)

edward, on Sep 20 2004, 10:46 PM, said:

For horses, perhaps Kajiya's original paper might work well. Off of google:
http://www.stanford....cs348b/results/

Something for i3d?

View Post


No need for i3d (although it could be interesting). They are implementing the scattering from a volume, but the actual local illumination for the Kajiya model isn't too complicated (and has problems). In pseudo-code:

Rdiff = Kd * sin(T,L)
Rspec = Ks * pow(dot(T,L)*dot(T,V) + sin(T,L)*sin(T,V), roughness)
Rfinal = Rdiff + Rspec

Where:
T = normalize(dPdt); // for an open poly
L = normalize(L); // inside an illuminance loop
V = -normalize(I);

And where the expression "sin(a,b)" (where a and b are normalized vectors), 
can be written as sqrt(1.0-dot(a,b)^2)

And the problem is that it can look really "burned out" because it makes no distinction between front and back lighting.
Actually... I got curious so I just checked the code for the "VEX Hair" shader that ships with Houdini and it is exactly the model I just described!
So there you go... if you use the vex hair shader, you're using the Kajiya model.

[edit]
Actually... not quite. The vex shader subtracts the two terms for specular reflectance instead of adding them...hmmm; I'm sure they had a good reason, but I can't look into it right now...
[/edit]

There are ways to take directionality into account and attenuate contributions opposite the viewing direction. Plus you can warp T along +-N to emulate the two separate specular hits that real hair has (due to the fact that it's made up of layered cones, not a simple tube). When I get some time, I'll try to post a version of this.

Cheers!
Mario.

#10 edward

edward

    Grand Master

  • Members
  • PipPipPipPipPip
  • 3,339 posts
  • Joined: 10-September 02
  • Name:e.d.w.a.r.d. .

Posted 21 September 2004 - 08:37 PM

I forget now but I recall someone just this past siggraph saying that the sign had to be reversed from the Kajiya paper. Perhaps the paper mentioned in the VEX Hair shader explains why.

My point wasn't the fact of using the Kajiya model but rather to do a volumetric approach for the fine horse fur rather than using actual geometry.
don't panic!

#11 Mario Marengo

Mario Marengo

    Grand Master

  • Members
  • PipPipPipPipPip
  • 1,249 posts
  • Joined: 26-June 02
  • Location:Toronto, Canada
  • Name:Mario Marengo

Posted 24 September 2004 - 07:08 AM

edward, on Sep 22 2004, 12:37 AM, said:

My point wasn't the fact of using the Kajiya model but rather to do a volumetric approach for the fine horse fur rather than using actual geometry.

View Post


Hey Edward,

Yes, I agree. For millions of very short hairs, something like that would be the way to go. I was just trying to give Marc a version of the model that he could apply "right now"... only to then realize that the model is already available in the hair shop :lol: ... oh well.

There's also a statistical (as opposed to volumetric) method that was used for 101 Dalmatians... siggraph circa ?... can't remember... I'll try to look around for it. A statistical approach may be easier on the implementation side, than the volume thing -- (but only applicable for *very* short hairs, of course).

Cheers!
Mario.

#12 stu

stu

    Illusionist

  • Members
  • PipPipPip
  • 469 posts
  • Joined: 16-October 02
  • Location:Toronto

Posted 25 September 2004 - 06:02 PM

I found a straight anisotropic highlight over an oren-nayer type of diffuse contribution to be just as effective as the statistical approach for representing short, dense hair (cow, dalmation, etc.) with far less headaches, but that's just me.

stu




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users