Notifications
Clear all

[Closed] Global values of diffuse and self illumination

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?

5 Replies

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
      	try
       	(
    		--set the properties
      		m.diffuseColor = color 255 255 255
      		m.useSelfIllumColor = false
      		m.selfIllumAmount = 100
      	)catch()
      )

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?

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

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:

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