View Full Version : MR 3.5 Ambient Occlusion and Object Exclusion

12 December 2006, 03:35 AM
Hey there. Got a pretty specific question about Mental Ray's Ambient Occlusion shader. I've searched around but I haven't found anything on this already posted so my apologies if this post is redundant.

I'm currently using dental models to do a quick little animation where an overbite is corrected while baby teeth are being pushed out by the new teeth. I'm using Max 9 and the new Mental Ray comes with it.

I've found that an ambient/occlusion shader on the diffuse and self-illumination slots of the material for the teeth gets the look I want. My problem is that when some of the new teeth push through and I fade the materials of the displaced teeth towards invisibility, the invisible tooth now occludes the new one as they overlap and creates undesirable color on the new teeth. I've posted before and after renders to show what I mean.

I think my solution (short of compositing tricks from independent renders) lies in the
Incl./Excl. Object ID (Neg. = Exclude) parameter of the shader's base parameters. I've had a look through the Mental Ray manual for it but it seems to be a bit advanced for me.

The entry reads: id_inclexcl defines an object instance label (set with the tag keyword of the object instance in the .mi file) to be included (or excluded) from being considered occluding by the shader. Set to 0 the parameter has no effect. A positive integer means that only object instances with a label that matches this number will cause occlusion. A negative reverses the condition and includes all object instances except those with a matching label.

So I guess I have a few questions.
1) How do I assign Object ID's in the *.mi file and get the material on the new teeth to ignore the invisible teeth when tracing occlusion?
2) Alternatively, is there a way I could get the shader to ignore invisible objects (full transparency and no specular value) in general?
3) Is there a simpler way of doing this than I'm looking at? lol

Thanks for your time, cheers and happy holidays.

P.S. This is my first time attaching images to a post so I'm not sure they'll work. I don't think they're completely crucial to understanding my problem but I'm sure they'll help.

12 December 2006, 06:46 AM
You set the Object ID in the object properties via right click. Setting this to 1 and the exclusion to -1 will set AO to ignore that object.

Editing the mi file is not required. BTW - The properties for visability are not supported by MR and will need to be handled in the shader.


NOTE: I'm still in Max 8 so your experience may vary.

12 December 2006, 06:49 PM
Ah sweet, it works! Thanks man. For all of it's words I wonder why the user reference wasn't as consice as you :).

While looking myself I found that there's a "shader" you can put in the map slot of the exclude parameter. It's called 'shaveMRGeomPasser' and it lets you specify one specific object rather than an ID to be ignored by the occlusion calculation. I ended up making a new material for each affected tooth :surprised

Cheers man. Thanks again for the help.

CGTalk Moderation
12 December 2006, 06:49 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.