Saturday, September 15, 2007

Shave and Haircut: Shadows (Mental Ray Hair Primitives)

Wow Mental Ray Hair Primitives. What a change of pace. Wish I would have learned this 3 months ago. My new friend Doug (who is a master cg artist) spent a few days testing shave and haircut and has completely changed my outlook on how fur needs to be rendered...it's with hair primitives! Here are the major technical points are your shave globals, your light's shadow settings, and your mental ray globals:

Render Globals:
Change renderer to mental ray. Use Rapid Hair adjust the anti alasing settings down to get faster render time

Shave Globals:
Once you've switched to the mental ray renderer in the shave globals you will now have the option to change to "hair primitives" this essentially switches your hair to geometry at render time. I assumed this would make for really high render times but has massivly improved render times, though you have to pay closer attention to your light's shadow settings.

Light Attributes:

I only light hair primitives with spot lights. Once you've made your light, go to your attributes -> Shadows, check use depth map shadows. Scroll down down and expand the area that says "mental ray" here you will see attributes that deal with shadow maps. Enable shadow maps. I believe this overides your depth map shadow settings so you have to set a new shadow resolution (256 or 512 will give you soft shadows, 2048 4096 will give you sharp shadows). I've worked with shadows samples between 1 and 4 (I up the samples if I am getting bands), and I work with softness levels between .001 and .01 (this seems very sensitive).

This is a quick rundown, I'll flesh this out further once I have more accurate results. Though using primitives has taken what was once a 3 + hour render down to about 23 minutes with very similar (even better) results.

13 comments:

mfessenden said...

Just out of curiosity, what hair shader do you use with hair primitives?

wabash said...

Unless you override the color attributes (there is a box in the shave attributes you can check) the shave tip and root color will be default...exactly the same as lighting with the buffer.

If you do override the material you can apply shaders that you create in the hypershade....whatever shader you'd like to give the hair.

Alfo_O said...

Do you have any tips on how to render in different passes with maya2008, mray and shave?
Im having big troubles, trying to create a simple occlusion pass, mray crash everytime.
I just created a sphere , applied a yellow and pink checker texture on it, adjusted my shave parameters and created a light with raytracing shadows,and an hdri enviroment sphere, im using mray raytracing, and under the shave globals im using Hair primitives, i just linked my checker map to the shave tip color and root color so i have the same texture as the sphere, than in the maya render layers i created a new layer with applied an occlusion pass preset(a surface shader with mib ambient occlusion on the color..) than added the sphere and the ShaveDisplayShape MESH into it,(i tryed all the other shave nodes,but seems to be the only way to make it render)
than with this layer selected, pressed render. It start rendering than ERROR MESSAGE..and maya crash.

I managed to do it only in one scene done as above but unselecting the Override Geom Shade option, the problem looks like that if i do afterwards doesnt work anymore,is like work only the first time, if you check and uncheck it something append and doesnt work.

I probably do something wrong on the way i create the passes, do you have a better workaround?

Sorry for the long post, but im going crazy and i think shouldnt be that difficult, i couldnt find anything anywhere about it.

If you could help me or have a nice tutorial about it, would be great .

Thankyou

alfsici@gmail.com

wabash said...

Hey there alfo

I think the problem that you are having is using raytraced shadows and a raytracer render setting.

Using Shave and Haircuts primitives in mental ray I only use detail shadow maps on my lights w/ a rasterization settings. In mental ray I change the preset to Fast Hair which gives a good starting point for raster settings.

I have also tried testing final gather and ambient occlusion...but without success because it is just too much information to calculate, the render rams out and crashes. I think if it did ever work, the amount of flickering you would get would be insane w/ the occ and raytracing.

In my experience I thankfully haven't had to do a separate occlusion pass with hair.

You could experiment w/ different shadow settings to get a fake occ pass. For example render your hair as a beauty pass then render an additional pass w/ white hair and stronger shadows and mult that on top to get extra control..I don't know, it's a stretch.

Good luck :)

Alfo_O said...

Hi william, thanks for your explanation,
i will give it a go as soon as i get home and ill tellyou if it works.
I was really curious since for a production at work we did use an internal plugin to render fur ,and i had the chance to see all the passes for the render, im quite sure they did a pass for ambient occlusion aswell, the only thing i know is that they used renderman for all the passes, so maybe is a little different.
I just wanted to understand better the procedure of the render passes when you have fur in it, looking at some weta stuff i think that shave have good potential.

thankyou again.

Alfo

ps. you can take a look at the Danda here> http://www.foxs-biscuits.co.uk/ i just animate it, didnt touched anything else, but i think the fur and render is great.

Agustin Schilling - Freelance 3D / Compo said...

Hi william. I´m having problem when rendering fur with dynamics. I made a bear, with about 500.000 hairs. I rendered without dynamic in full HD in about 7 minutes the frame. Afterwards, i made dynamic cache and every collision is perfect. When i try to render in PAL, at 46% of the 1st frame everything crashes. I followed the setting you mentioned in your blog. Any tip you can give me?
thanks in advance!

Agustin

wabash said...

Hey Agustin,
What are your voxels set to in your shave globals? Sounds like maybe you are dealing with a memory crash, I'm not sure.
Try setting your voxels to 20x20. If that doesn't work try decreasing your hair count by 1/2 and try to render just to check that your scene is indeed using too much ram. If it is a ram issue you are going to have to sacrifice something, haircount, dynamics etc. until you have a scene that your computer can handle.

Agustin Schilling - Freelance 3D / Compo said...

Thank you very much, wabash! I´ll try doing what you told me. Although i´m working with a dual quadCore, 8 gb RAM, the render can´t deal with it. Later i´ll tell you how it´s going on.
(My spanish is better than my english, sorry for it. :P)

Agustin

Brett Sinclair said...

Hi William.

Is there anyway to render out the shadows for hairprims? The only way I've found is to convert your hair to geometry and just turn primary visibility off. Is there another way?

Thanks
Brett

Anonymous said...

for those who have maya crashes problems i have a solution what works in my case all i do is actually after i make all the settings i save the project and close maya then i reload maya again and the last project save and do the rendering without doing any modification on the scene i see when i do modification on dinamics or i work in outliner when i hit render maya crashes when comes to render hair systems even if i render one hair ,when i hit render with this metod maya don't crases anymore in my case

Anonymous said...

Hi William,

Sorry if It's a quite an old post but there is so little information regarding Shave and a hair cut. I followed your post to create shadows and it worked like a magic! However I ran into a problem that self-shadow and geo-shadow attributes on shave don't work when I use hair primitives. Do you know why is it happening by any chance?

When I switch to buffer, those attributes work just fine. But can't use buffer mode because it takes too much render time per frame.

Thank you.
Natalia

Anonymous said...

generic viagra india buy viagra in london england viagra doseage viagra strips viagra rrp australia cost viagra sales herbal viagra reviews instructions for viagra use cheap viagra nz buying viagra pfizer viagra free sample viagra online viagra viagra alternative

David said...

Hi, I wondered if you could help me, when I use hair primitives my hair renders white its supposed to be black and I havent checked "overide geometry shader" ? so it shoudl use my root and tip colour right ?

even if i delete all my lights its still the same?
thanks