sphereLight mel script version 1.5
[All the materials provided on this page are copyrighted]

(see what has changed in v1.5)

The sphereLight mel script is a script based on the skyLightControl.

How it works:

The overall lighting is spherical this time, unlike the skyLightControl which was hemispherical. It is composed of 2 groups of directional lights, the skyLight and the ground lights.

There are 16 lights per group so you'll have 32 lights for the whole 'global' lighting.
Each light only emit in diffuse so, you'll never have little specular highlights on your objects.

The differences between the skyLightControl and sphereLight mel script:

- The skyLight used 2 different lights (ambient and directional or point lights) for the illumination and shadows.
The sphereLight only use directional light emitting light only in diffuse, so twice less lights for a twice faster and accurate result.

- The skyLightControl can emit light from a texture or a solidColor.
The sphereLight can emit light from 2d textures and most of all 3d textures (read the limitations regarding 3d textures).

- The skyLightControl provided color calibration features (contrast, hue, saturation)
The sphereLight provide the same color calibration features plus a gamma modifier.

- The skyLightControl had 'directional' or oriented shadows.
The sphereLight's shadows are by default cast by the 'sky' lights, and are uniform. You can however set the 'groundLights' to cast shadows.

- The skyLightControl had different intensity attributes (lowLights, highLights, global Intensity)
The sphereLight have only 2 independant intensity attributes: sky intensity and ground intensity.


How to use the sphereLight mel script:

Copy the sphereLight_lights.ma scene (included in the .zip) into your script directory
IMPORTANT: Modify the line 1053 (!!) of the script in order to set your own 'imported scene' path.
Then source the script, and execute it.

Automatically, the lighting scene (sphereLight_lights.ma) is imported, and the needed nodes are created and connected. If the sphereLight group is too small, select it and adjust the scale to fit with your scene.

To modify the lighting intensity, color calibration, shadowColor of the 'skyLights' and 'groundLights', select their respective group (under the top sphereLight_group) and open the extra attributes:
On your left, the skyLight attributes, and on the right, the groundLight attributes.

As you can see, by default, the sphereLight emits solid colors for both of the sky and ground lights.
To emit from a 2d/3d texture, just drag your texture to the skyColor or groundColor, and the script will create, duplicate all the needed nodes.

You can modify any attributes of your selected texture (colorBalance attributes (defaultColor, colorGain and colorOffset) are not linked to lights) and the lighting will follow accordingly.

To set the groundLight lights to cast shadows, just check on the castShadows check box and refrsh (in IPR) or re-render the image to see the change.
If you need to change the texture you plugged into the color attr of the sky/ground , just disconnect it, and all the duplicated nodes will be removed. Connect a new texture, and the script will rebuild the whole network (Hey guys, mel's cool and powerfool!! ;-))

Pay attention at if you modify the rotation of the domeSurface (sphere nurbs surface) or the sphereLight_group, the result (lighting) will follow accordingly the rotation. Translation affects also the result of the lighting.

This is it folks, nothing spectacular as you can see, but you may find this script useful if you just need a simple but realistic global lighting.

 

Improvements from v1.3 to 1.5:

- You can connect/disconnect all the 'acceptable' 2d/3d textures you want. Almost of the nodes needed by script are removed automatically to preserve speed.

- skyLight lights and groundLight lights are controlled independantly for a better handling.

- groundLight lights can emit shadows.

- You can previsualize in hardware how your textures look like for both of the sky and ground textures/color.

- All the shadows are renamed according the light's group, including their resolution (i.e.: skyLight1_256.SM.iff, etc..)


Limitations:

During the script process, an error message is displayed: "//Warning: shader had no shader group. A shader group was created//"
This is normal!! And it has no effect on the result. However, I'll try to fix that in future versions.

3d textures:
- Most of all 3d textures can be used by this script except the snow texture, all the 3d envmaps and the layeredTexture.
Be careful with some 3d textures, because you might get strange result (little outlines depending on the texture) if you set some attr. values too high.

- For some particular reason (thanks to Forest), you'll have to connect manually the outColor attr. of the stucco and crater texture to the skyLight_group.skyColor or groundLight_group.groundColor.

Get the sphereLight mel script v1.5

 

sphereLight mel script v1.5 (c) Emmanuel Campin - July / August 2001