softDiffuse mel script

 

To execute this script, first source it in the script editor, then select your shaders and execute the script.

This mel creates a shading network based on the light's direction of a light (any type of light) mapped into the ambient attribute of any material you have selected. If you already had or have to map with another texture this ambient attribute, connect (manually or make a quick mel loop) the output of the vectorProduct node to the colorGain of your ambient texture.

Globally this shading network adds a more diffuse lighting to your objects. It also enlights the shader (as it's mapped in ambient). But to avoid having an totally ambient material when the light is for example behind your objects, I've added a surfaceLuminance node to force the shader to be unlit (ambient = 0) when it has to be unlit (because if you don't, it shines!!)

It creates a light (pointLight by default) called softLight which is located at the origin of the world [0,0,0]. Select it and place it wherever you want to see how it affects the materials.

Well, here are some sample images without the shading network.

On the picture on the left, the shading network is not applied. This is the default lighting and shading with our light.
The picture on the right is the same picture, but I have set the ambient attribute to 0,9 on all of my shaders.

The picture below is the shading network connected to the ambient attribute, and you can see that you have the same illumination as the pict. on the right, but with darker shadows.


T
hat's what the script does and I wish you good luck to use it and enjoy it!! ;-)

 

download mel script

Limitations:

I noticed that the illumination wasn't uniform when you set a light above a plane. Be careful when an empty plane surface has the shading network connected to its shader.

Workaround: No workaround at that time.

 

softDiffuse mel script - Emmanuel Campin - April 30th 2001