View Full Version : Global values of diffuse and self illumination

02 February 2006, 10:30 AM
I need to change all diffuse and self illumination values to white on all my materials. At the same time all the opacity maps on all materials has to remain the same.

Can anyone lead me to the script to do it?

02 February 2006, 10:34 AM
Hello Heiki,

i hope this will do the trick:

-- loop through scene materials (sceneMaterials is a global variable
-- that contains all applied materials in the scene)
for m in sceneMaterials do
-- some materials (multi/sub-object mats for example)
-- don't have the properties we're trying to set,
-- a simple way to avoid the error this would cause
-- is using the try()catch() expression
--set the properties
m.diffuseColor = color 255 255 255
m.useSelfIllumColor = false
m.selfIllumAmount = 100

02 February 2006, 10:45 AM
Thanx so much Aearon!

It works but has only one problem. Can you add to the script the function to disable diffuse map also. Right now it turns diffuse color to white but leaves the texture to the diffuse slot. Is it possible to disable map (to NONE) in diffuse slot?

02 February 2006, 01:07 PM
sure, just add "m.diffuseMapEnable = false" to the script

by the way you can check this kind of stuff like this:

meditmatrials is a global var containing all material editor mats

to get the material in the first slot do this:

myMat = meditMaterials[1]

now to get all the properties for this material (like the diffuseMapEnable above) type this:

showProperties myMat

02 February 2006, 04:02 PM
Thanx Aearon!!

The script works just great!! The reason I needed this is because to make fake zdepth channel for dof. Max zdepth channel doesn't count with opacity maps.

Is it possible to make this script as a render element? :) Also it should include environment|fog (exponential, min 0%, max 100%).

Here is an example also:

02 February 2006, 06:22 PM
sorry Heiki, haven't played much with render-related scripting, but what you could do is setup the fog effect using a script as well, and also turn off a bunch of options you don't need for this pass, for example lights and shadows among others

this can definitely be fully automated

CGTalk Moderation
02 February 2006, 06:22 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.