Control A&D Materials Globally!
Ok,
I often get tired of having to render AO (ambient occlusion) passes along with rendering my animations. I've often wanted to just use the AO setting in the A&D materials, but I'm way too lazy to go through all of my materials in my scene to turn them on, so I wrote this simple maxscript that does several things for the A&D material:
-turns on AO in all A&D materials of a scene
-sets the AO spread distance to 3'
-turns off backface culling for all materials in scene
Here it is:
I can't take the credit for this script. A big thanks to max expert Louis Marcoux. This script can also apply to any other parameter in the A&D material. If you want to change other parameters of the A&D material, you can find them here. And substitute /add them into the script.
I often get tired of having to render AO (ambient occlusion) passes along with rendering my animations. I've often wanted to just use the AO setting in the A&D materials, but I'm way too lazy to go through all of my materials in my scene to turn them on, so I wrote this simple maxscript that does several things for the A&D material:
-turns on AO in all A&D materials of a scene
-sets the AO spread distance to 3'
-turns off backface culling for all materials in scene
Here it is:
for a in objects do
(
if (classof a.material == Arch___Design__mi) then
(
a.material.opts_ao_on = true
a.material.opts_ao_distance = 36
a.material.opts_backface_cull = false
)
if (classof a.material == Multimaterial) then
(
for b = 1 to a.material.numsubs do
(
if (classof a.material.materialList[b] == Arch___Design__mi) then
(
a.material.materialList[b].opts_ao_on = true
a.material.materialList[b].opts_ao_distance = 36
a.material.materialList[b].opts_backface_cull = false
)
)
)
)
I can't take the credit for this script. A big thanks to max expert Louis Marcoux. This script can also apply to any other parameter in the A&D material. If you want to change other parameters of the A&D material, you can find them here. And substitute /add them into the script.
I make global changes to objects in my scenes using maxscript quite a lot and have been meaning to make a script to do exactly this for ages.
ReplyDeleteThanks for saving me the effort Ramy! :)
Chris.
Hi Ramy...Very nice post man :)
ReplyDeleteIn my product Swift-Switch, i scripted this kind of function to checkbox. I used the following command:
for i in 1 to 24 do
if ao2.tristate == 1 do
(
try meditmaterials[i].opts_ao_exact=on catch ()
)
for i in 1 to 24 do
if ao2.tristate == 0 do
(
try meditmaterials[i].opts_ao_exact=off catch ()
)
where ao2 refers to the name of my checkbox. I hope this is useful :)
Visit my blog: http://swiftswitch.blogspot.com/