Jump to content

Hair revisited


Marc

Recommended Posts

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.

post-3-1095458382.jpg post-3-1095458388.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.

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 RiTube.zip

Link to comment
Share on other sites

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.com/resources/coursenotes.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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

For horses, perhaps Kajiya's original paper might work well. Off of google:

http://www.stanford.edu/~turitzin/cs348b/results/

Something for i3d?

13899[/snapback]

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

13921[/snapback]

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

13974[/snapback]

Hey Stu,

That's good to know. Thanks for the insight!

Wouldn't it be funny if after a month of R&D you ended up with something not that different from what Marc is already using?!? (except with an anisotropic specular) -- hehehe... wouldn't be the first time something like that has happened :rolleyes:

Thanks.

Link to comment
Share on other sites

Hey Stu,

That's good to know. Thanks for the insight!

Wouldn't it be funny if after a month of R&D you ended up with something not that different from what Marc is already using?!? (except with an anisotropic specular) -- hehehe... wouldn't be the first time something like that has happened :rolleyes:

Yeah, I don't know how many times I've knocked out a simple solution in 15 minutes and spent days noodling it only to go back to what I had in the first place. ;)

Edited by Jason
Link to comment
Share on other sites

ok smart fellows.

Let's pretend that I've decided to instance a ton of hairs onto my horse. Shouldn't be too bad since all you see of his skin/fur is the head and arms.

So, thinking that I would like to be alarmingly clever about the whole deal, I'd like to paint a texturemap and have the hairs pick up the colours of the texture, that way I have an easy method of getting nice colour variation across the surface of the horse.

So what I did was put an attributecreate down after all my instance points are created and do the fancy op:/ call for the shader (courtesy of Steven Ong), replacing the diff colours with $CR,$CG,$CB. Needless to say, this is alarmingly painful when its trying to shove this large string onto 100 000 hairs (ouch :shocking: )

op:/vex/MM_Hair2 fsize 1 diff $CR $CG $CB spec 0.01 0.01 0.01 urough 0.1 vrough 0.1 _shop_ /shop/MM_Hair21

My current theory now is to assign the relevant uv's to each hair point and use a texture call from within the shader to pick up the diff colour at that point. I think this will be a gazillion times faster.. assuming it works.

If anyone has any better ideas then let me know.

M

Some cute furballs :

post-3-1096669231.jpg post-3-1096669238.jpg

Link to comment
Share on other sites

looks cool, its not right, but it looks cool :)

post-3-1096673468.jpg post-3-1096673473.jpg

It seems to be attaching the texture map to each hair. Which is, of course, exactly what it is doing. I need to evaluate the colour at that uv co-ordinate and make the entire hair that colour...

Still figuring out how to do that :),

P.S. The second one is the mandril.

Link to comment
Share on other sites

Here's another nice link to fur generation

Rythm&Hues Fur

Also, have you seen the Sesi demo of the bunny rabbit with fur on it. Looks very nice, it just uses the scatter sop, some combed normals and copies a short line to each point. I'm also guessing they just used the default houdini hair shader.

Reading the stuff about how they did the fur for Stuart little I particularly liked the idea of mixing the surface normal with the fur tangent in order to calculate the fur shader lighting model. I like the idea that you can you light the skin as normal and the fur won't change the look too much. Not "physically" correct but very controllable, a nice bodge. :)

Link to comment
Share on other sites

Hey Simon

Thanks for the link, that's great. Nice tips in there.

I think between the Stuart Little paper and that one, I should be able to get some nice fur.

I like the shadowing hack in the RnH paper too. Very clever :).

As for the fur, I'm combing the normals and scattering points (which then pick up the normals). Once I get the texture map lookup for hair colour working then I'll try and extend the method to define all the other characteristics I need (a map for length, for instance).

Probably going to have to do alot of this outside of houdini though. Mantra procedurals are looking good right now, if only I knew how they worked :rolleyes:

Nothing like jumping in the deep end though.

Ciao

M

P.S. All we need in Houdini now are deepshadows or their non patented equivalent ;) and we're good to go...

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