Lighting a virtual world is simple and complex effort. The simple part is just add a few lights and everything is ready to go. The complex part is adding the right lights in the right locations with the right colors and control parameters to make your world look right.
In the physical world the sun provides nearly all of the light for outdoors during the day. At night or indoors a collection of lights is used for illumination. In either case reflection from other surfaces (including the sky) provide ambient lighting softening the shadows and spreading the light into areas not directly illuminated.
X3D does not provide for the generation of shadows or reflections. Ambient light is supported in all three light nodes and through the Material node. Surfaces not directly illuminated are only visible if there is ambient light in the scene and the surface is receptive to ambient light.
X3D attempts to simulate the physical world with a complex lighting equation that includes factors for each light, orientation of the surface to the light, material properties, and fog. The complete lighting equation can be found here. The lighting equation defines the color of each surface element in the scene. There are still factors related to the scene geometry (orientation of the surface relative to the viewer, obscuration, and visibility of objects behind transparent surfaces) that effect the screen pixels.
This series of articles will look at the effect of ambient lighting in clear air (no fog) and reflective surfaces (surfaces with a Material node but with no emmsive color). The first article considers the easiest case when the light is direct (DirectLight) and there is no specular color. The surface element color (Sc) is
Sc = sum over Lights (i) of (on(i) * Lc(i) * (ambient(i) + diffuse(i)))
|on(i)||is a flag that indicates if the Ith light is on (1) or off (0).|
|Lc(i)||is the color of the Ith light.|
|ambient(i)||is the color of the surface due to the ambient component of the Ith light.|
|diffuse(i)||is the color of the surface due to direct component of the Ith light.|
The diffuse component is dependent on the angle of illumination to the surface normal, intensity of the light source, and the color of the surface due to texturing, per-face and/or per-vertex diffuse coloring.
The ambient component is the product of the ambient intensity of the light, the ambient intensity response of the material (Material node's ambientIntensity), and the color of the surface due to texturing, per-face and/or per-vertex coloring.
Direct and ambient lighting have two different effects on the lighting of the object. The shading of a solid colored object is determined by the change in incidence of light onto the surface. As the surface curves away from the light source, it gets darker. Therefore, the shading is completely controlled by direct lighting.
The contribution from ambient lighting is independent of the direction of the light or the orientation of the surface. Ambient lighting provides a uniform color over the object.
To illustrate this effect, the example shows a large sphere on an even larger plain. The initial lighting is only from overhead. It has a slight yellow cast to the color. Clicking on the sphere turns on and off ambient lighting from the sky with a slight blue cast. You should notice that there is no color shading on the bottom of the sphere in either case. When the sphere is strictly illuminated from above, the bottom is black. When the ambient lighting is turned on, it adds a blue component to all lighting. There still is no shading on the bottom of the sphere because the light comes from all directions equally.
This world also includes the ability to add light from ground reflection. This light is much less in intensity than the overhead light, in the opposite direction, and has a strong green coloring. Clicking on the ground near the sphere turns this light on and off.