View Full Version : Really Need Hair Rendering tips for Maya Hair or Shave in Mental Ray

07 July 2009, 06:50 AM
So I need to do stylized hair for a character. What I've done is built nurbs tubes for the general shape/volume of the hair. The nurbs are rigged to the head and then curves are duplicated off the nurbs surface so that they follow the nurbs.

From there I've tried two directions:

Shave and a Haircut. This seems to look alright, but my render times seem crazy high. I'm not using final gather, just a few spot lights using ray traced shadows. The model has the fast SSS shader on it and some MIA and blinn shaders. The hair does go through the SSS model, not sure that it matters. The shave hair is assigned to the curves on the hair so that it follows it. In the shave globals I've been shooting for a buffer render, just trying to leave it on draft right now, but have been trying to do 3D volumetric. This is for animation too, so I've been assigning shave shadow attributes to the lights with 1500 set for the resolution and 30 for the fuzz settings. The thing that is bugging the hell out of me is that my render times are around 40 seconds on draft and 8minutes, 30 seconds on production quality in MR. Once I add the hair, it goes up easily over and hour, maybe a couple hours. I'm watching one going right now for I don't know how long now, and it hasn't even gotten to the area with hair yet. What the hell is the deal with that?

I've tried geo primitives for rendering with not much better render times and it looks a little bit too much like geo to me. But if anybody has any advice on that, I'm willing to go back there.

I've tried also converting the hair to geo, but them Mental Ray can't render it because it runs out of memory at the start.

Maya Hair:
So again, I've assigned hair to the curves here, and haven't done a whole lot other than tweak the looks of the hair. The biggest issue here for me is when animated it's like a noisy salt and pepper which is useless for motion. I'm trying to figure out how to get it to look smooth and can't figure that one out. Turning a various number of my render samples up seems to help (I haven't nailed down which ones are exactly doing it yet) but kills the render time and the hair is still noisy.

As well, this character is wearing a cap and to get the hair looking dense enough but not like yarn, I had to turn the clump radius up which then has hair growing out of the cap. If anybody knows a way to clip individual hairs, since this isn't actually growing out of the scalp, that would be very helpful as well. If it just seems like I should be growing it out of the scalp and using the curves as a guide as the obvious solution, please let me know that as well, and if I would have to make sure that all the curves are outside the head shell.

Most of the MR settings I've been trying draft, preview and production for render settings. Doesn't seem to change much other than render times and anti aliasing of everything but the hair.

07 July 2009, 10:10 AM
When you say a few spot lights I think this couldnbe your problem. Hair like any dynamics falls to an absolute crawl once you add more than 2-3 lights with ray tracing.

Delete all your lights and place in 3 directionals (key, fill, bounce) and just give ray tracing to the key. That should be enough.

Post an image of the sort of stylised hair you're aiming for (pixar?) and I'll try and help some more.

Ps forget about maya hair. It's 5 years behind the times.

07 July 2009, 05:15 PM
The best workflow for Shave&Haircut is to use MR with the Shave globals set to render Primitives. And DO NOT use raytracing. Use a render preset like Rapid Fur to get started. The rasterizer is the fastest engine for fur and hair.

If you need shadows, just use depth map shadows. I've had hit & misses with using detailed shadows, but depth map at least is good.

From using the buffer and switching to primitives, I got a better result and rendertimes went from 30min to 5min a frame.

Good luck!

07 July 2009, 07:12 PM
Do you have any advice on settinsg then, if I use geo primitives and depth map shadows? I kept trying to use depth maps, as per the advice here:
The result I got looked like sorta a stylize gouache look, where all the colors were sorta muted and blotchy and everything flickered during animation, and I haven't figured out what setting would correct that.

I assume you guys are doing a hair pass for just the hair and then composting it? How do you set up the model in that case? Are you just putting a use background shader on the model, or do you use render layers?

Also, when I use geo primitives, it really does look like plains of geo. Are there certain hair settings you use to bring it back to look more like hair? It could just be the curve set up I'm using where it's too dense in certain areas, since I'm not growing it and styling it off the scalp.

And here's pretty much the look I'm going for. Something around the shape and look of this:

07 July 2009, 02:51 AM
Ok, So after some tweaking on the lights, I got something that roughly matched the quality of the ray trace render on the geo part (Not rendering the hair yet, just trying to figure out the light settings.)
I ended up with 3 spot lights with a resolution of 1024, 50 samples and a softness of 0.014. Where it took about 40 seconds to render a draft quality version of this in ray tracing it takes about 8-9 minutes a frame to render just the character now (but in theory, I can do a render pass of the character in ray trace and do the hair pass in dmaps, right?)

Hair is proxy geo like everybody suggests, shooting for medium quality in the shave globals, but just going for draft in MR (not sure if MR settings are part of the hair quality settings, or if it just uses Shave Globals for quality.)

So here's the problem. I'm still not getting those super fast render times everybody is talking about. I've got one batch render going, where it's not composting the hair during render, but saving out a separate file from the character. Though it still seems to be rendering the character as well (there a way to by pass that?).
I've got another computer doing a batch render of pretty much the same thing but the character has a surface shader assigned to it, so it shouldn't take as long to render.

Both of them majorly stall at about 40%, which according to the real time render view is about the point it hits the hair. It's still taking hours to render this stuff, not minutes. Is it just that my samples on the lights are far too high, and if I lower them, it will go faster and my renders won't show any noticeable quality difference?

Any other advice for speeding this up would be much appreciated. I've got a little over a week to figure this out and get about 90 seconds of animation out with this in HD, so I need that balance of speed and quality here.

07 July 2009, 08:20 AM
Ive been struggling with shave and a haircut for my last project. And I think I stepped into almost every obstacle possible, but by now I do get nice renders within somehow reasonable time.
What I did:
I render in mental ray and use spot and directional lights to render. I do use raytrace shadows! not dmap, I render two characters with 4 shave nodes altogether.
I use rasterizer render and Hair Primitives.
My render times are about 10 - 30 minutes on 8GB ram 64 bit quadcore machines (HD resolution). Ive got quite some renderpower at my hands, so I didnt care about the raytrace shadows, but i guess with Dmap i would have been able to get way lower.

So your problem is, you get very low render times in draft quality (40 secs) but as soon as you switch to your fine quality settings the render times go crazy?
could you post shots of your scenes and settings? this would help


07 July 2009, 09:10 AM
Yeah, a lot of my trouble seems to be from the computer processing power I have available. Just duel core computers, with 3-4 gigs of memory and on 32 bit windows, and we have about a weeks timeline to get everything out some how. What I was shooting for was something that could ultimately be done in one pass because I'm not sure there's time to set up all the needed render passes. We just started getting scenes ready/near ready with animation. Somebody else set up the lights for the scenes, but what they currently have has no cast shadows. Renders really fast but looks like game art and he's using quadratic decay on the lights which shave won't recognize.

I wish I could post stuff, but I don't think I can as this is stuff going to comic con.

Rght now, on preview/medium quality, I'm at renders around 25-30 minutes, but at full rez I think I might break our render time window. As far as the quality, the tests I did with dmaps looked better, but I'm guessing half of it is I didn't have time to really test out ray tracing once I was getting the hang of it.

The render times are really low without the hair. A production quality render, under ten minutes a frame. Throw in the hair, we're at least trippeling that time, or at least thats what I was getting at last, but that's just for the hair pass. Include the regular models pass and there's another 10-20 minutes added on (and that's only a guess because we haven't done anything with motion blur yet). Gets a little better each time as I find the sweet spots more and more, but it's all with dMaps. Ultimately I need to shoot for under 30 minutes a frame, that's for an entier shot, so hair plus the models at final quality, in a week, which makes for a rather tight budget.

Anyway, here's what I've sorta come down to. Three spot lights on the hair. Mental Ray Detailed Maps. Map size around 1024, Sampling around 16, filter around 0.15. I've been adding Shave Shadow attributes, as per a tutorials advice with Samples of 1500 and fuzziness of 30, though I'm still not particularly sure what that does. I'm rendering out hair primitives. Then for mental ray render settings I've just been setting it to Rapid Hair, since I'm only using the hair out of the pass. I think what I'd really need is a fancy trick at this point to speed things up, or a render farm with Shave available on it for the cheap.

Right now the best option might be to use polygon hair where ever possible (totaly length of the shots needed is around a minute and a half, two minutes, not all close up, but most are.) But that all depends if the alpha maps render any faster with ray trace shadows.

What would help the most is if there was some way to render out just a hair pass, without having to set up a seperate scene with the objects masked off, so it doesn't have to render everything else in the scene, but the lights are there and being blocked the correct way by the objects there. Since bounce light doesn't seem to affect it in the method I'm using, that wouldn't be an issue. I did one test with a version where all the models had a surface shader on them to try and speed up the render, but the time difference wasn't noticable.

I wish I could say or show more. I know this is hardly anything to work on, but I'm getting the feeling that the constraints here aren't so much due to the settings than the timeline and resources available. If anybody has any tips to add on at this point, I'm willing to try them, but if not, I think I've gotta run with what I've got working so far and just hope it'll work out some how. Seems like when ever I end up in this type of project sinario, nobody ever leaves enough time for rendering.

07 July 2009, 10:15 AM
I ended up with 3 spot lights with a resolution of 1024, 50 samples and a softness of 0.014. Where it took about 40 seconds to render a draft quality version of this in ray tracing it takes about 8-9 minutes a frame to render just the character now.

3 lights each with 50 samples with a softness of 0.014!?!

Yeh, you might wanna look up how to use spotlights. 8 samples is more than enough.

Try what i said about using just one light with ray tracing shadows.

07 July 2009, 10:35 AM
Try what i said about using just one light with ray tracing shadows.

Ray-tracing hair is silly, detail shadow maps are definitely the way to go.

07 July 2009, 11:07 AM
I was rendering all my scenes with ray trace shadows. I was trying depth map shadows, but the results I got were far from satisfactory. All jagged or too blurry. I was fiddling with it for some hours and got nothing I wanted to go with. So at the end of the day I simply turned on ray trace shadows, hit render on 4 machines and next morning I had beautifully detailed render shadows for my close ups.
But with having only 3 close up shots it was doable.
All other scenes I used modelled hairs (transparency planes)

so what you can do:
render a separate hair pass (output hair images in the Shave Globals) this only works for buffer mode in Maya software render.

Or you set up a separate render pass in mental ray where you apply use background materials to your models so only the hair and its cast shadow is visible

the best and most time efficient results in mental ray I got with:
rasterizer render mode
hair primitives
2D Post
quality low (the quality settings only seemed to make a significant difference when in geometry mode)

07 July 2009, 11:49 AM
I usually start with 8, but 50 is what it took to get the graininess out of the cast shadows the character was casting on the background because I have no light radius or final gather to soften them. Again, these are mental ray depth maps, not Maya's or Ray Tracing settings. And if there's a better way to soften the shadow in a quality and timely manner, I'm not aware of it. (Meaning if there is one, I'd love to know that trick.)

I'll give the single light another shot. Part of the issue was not wanting to tweak with the existing scene's lights too much so I don't have to do a lot of guessing and rendering to match the scenes intensity, and there's usually about 3 lights on the character doing most of the lighting. If I take one off, it doesn't quite match and if I leave it alone, it blows out the hair. Again, wouldn't be such a big deal if it wern't for the time pinch. The bitch part coming up is that there's a lot of flashing lights and sparks flying in a number of these shots, so I'm hoping they're conservitive on what ever they're animating.

Oh, thank god you told me about the render passes only working in Buffer. I was fiddling with that a bunch the other night trying to figure out what I was doing wrong, which was rendering in geo primitives. And even if I render out in buffer mode, it still renders out an image for the scene, right? It just doesn't composit them. If I could render out just the hair only, that'd make so much more sence, but it seems like it always wants to do the scene too. Like it won't save me render time. It'll just give me a seperate file for the hair pass, and one for the rest of the scene, right?

Does use background shaders actually still block the light where needed in that case? Like if I had a pillar between the light and the hair, if the shader was on the pillar, the light would still be blocked? And vice versa, can a character cast shadows onto an object that has a use background shader on it, or do I need the object there if I want shadows from the character too? I guess if I do a pass with cast shadows on objects, I'm going to need to multiply the shadows anyway, if I don't want any artifacts, so I'm guessing that idea won't fly. A lot of this crap I used to know, but it's been a while since I've done rendering.

Also, does anybody know what the Shave Background shader is for exactly? I've only seen one forum mention it, but I couldn't figure out what exactly it does, and I didn't see anything in it in the documentation. The forum just had something about hooking it into the shader engin, and I think it refferenced something about working with the SSS shader. I've put one on, taken it off and can't see any noticable difference, but I'm not sure I had the right render settings to ever utilize it anyway.

Anyway, I'll give this stuff a shot. Everybody I hear from seems to be echoing the same things, so I think I've got a good idea of what I have to work with so far, so thanks to everybody so far that's given advice. It's helped guide me along the way. Now if only Comic Con was magically delayed a week or two...

07 July 2009, 03:01 PM
Cheesestraws ( is right. Always use Detail ShadowMap for hairs, but not Ray Trace Shadow or Regular ShadowMap.
Also Rasterizer mode render hairs about 2-4 time faster than scanline.

50 Pixel Samples for shadowmap is not same that 50 samples for raytrace shadow.
For shadowmap this value is not so high. And it's not so performance impact. But in most cases 32 samples is enough.

07 July 2009, 11:40 AM
yes, they are right about using depth map shadows. I resetup a scene with depth map shadows now.
the problem I was having before with the improper dmap shadows was, that I was NOT using the mental ray override but the maya depth map. Those look lousy.
The render times with my dmap shadows, even with high quality settings is way lower than with raytrace.

Puppet and Cheesestraw are right! thanks guys!

I do have:
spot lights with
res 1024
samples 8 - 12
softness 0.001 - 0.01

07 July 2009, 12:33 PM
Don't forget to use "Detail Shadowmap" instead of "Regular Shadowmap".

P.S. Maya's shadowmap settings will be converted to mental ray settings during translating scene, so to be clear just always use directly mental ray shadowmap setting. It's more simple and clear.

CGTalk Moderation
07 July 2009, 12:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.