View Full Version : Creating an AO pass from a scene with displacement shaders

04 April 2009, 01:42 PM
I'm using mental ray and 3dsMax2009.

I want to create an Ambient Occlusion pass of a scene that I have created. The scene has a lot of materials with displacement maps which prevents me from just going to Render->Processing and using the Material Override tool. Is there an easy way to get an AO pass on everything while keeping each material's displacement? The only way I've been able to come up with so far is to make a generic AO material then a custom AO material for each material that has displacement, as you can imagine this would be super tedious to setup/apply each time I wanted to do a render.

04 April 2009, 04:11 AM
Hi Jordan,

I have written a simply maxscript below, hopefully it can help you. All it does is assign an AO in diffuse slot and remove any map from every slot except Displacement slot.

a = sceneMaterials
n = a.count
for i=1 to n do
a[i].diffuseMap = Ambient_Reflective_Occlusion__3dsmax ()

-- Customize AO Map Parameters
a[i].diffuseMap.Samples = 20
a[i].diffuseMap.max_distance = 20
-- End Customization

a[i].specularMap = undefined
a[i].specularLevelMap = undefined
a[i].glossinessMap = undefined
a[i].selfillumMap = undefined
a[i].opacityMap = undefined
a[i].filterMap = undefined
a[i].bumpMap = undefined
a[i].reflectionMap = undefined
a[i].refractionMap = undefined

* I do not include all AO Map parameters, you may need to complete the section to make your own AO map.
** This script only work on Standard Material, if you use material other than this, simply use the script listener to find out the name of each slot.

If you find other workaround please let me know, I'm interested as well. Thanks.

CGTalk Moderation
04 April 2009, 04:11 AM
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.