S3's Transform and Lighting Engine
White Paper Courtesy of S3 |
||||
Directional Lights A directional light is the simplest type of light that can be used. Here, the light source is treated as a point an infinite distance from the object being viewed. The light rays that arrive at the object are therefore parallel. An example of a directional light is the effect of the sun at the surface of the planets in its orbit.
Directional Light Although it is not a point source, and it is not an infinite distance away, the rays that arrive at the surface are sufficiently close to parallel that the effect is the same. This can be seen in Fig. 2 as the directional lit soccer ball's lighting has a similar look to that of the planet's. All that's required to specify a directional light is its direction, color and intensity (brightness).
Point Light Point Lights While directional lights are excellent for modeling light sources completely outside a scene to be rendered, light originating from an object inside the rendered scene usually needs to be modeled by a point light, which adds position and attenuation to the parameters required to specify the light. A typical point light source would be a candle, which casts light in a uniform sphere in all directions. The addition of attenuation allows the intensity of the light to decrease with the distance from the object on which the light is being cast. In software lighting, point lights are usually significantly slower than directional lights - requiring approximately twice as much time to calculate. This is not the case with hardware lighting where the two have very similar performance. Spot Lights Spot lights are the most complex type of light as they add the ability to define a cone outside of which the light source cannot shine. This is useful for modeling searchlights, flashlights, headlights or any other application where the area of light fall must be carefully controlled. Spot lights require the most computational effort to generate the resulting color values and, as a result, are rarely used in traditional software methods. With hardware, there is still a performance penalty, but it is relatively small and certainly less than a factor of 2. |
Spot Light With spot lights, two separate colors are calculated for each vertex: the non-reflective or 'diffuse' component, and the reflected or 'specular' component. The diffuse component considers only the material of the surface and the colors of the light while the specular component simulates the light reflecting directly from the object such as the reflection of room lights on a polished table. To find the final color value for lighting a vertex, first a total diffuse and a total specular color are generated by summing the respective components created by every light in the scene. An ambient color contribution, simulating other lighting in the scene, is then added to the diffuse color and then these final diffuse and specular values are applied to the surface. Direct3D and standard OpenGL differ slightly in the way that they do this. Direct3D applies the diffuse color before texture and the specular color after texture, while OpenGL applies both beforehand. An enhanced OpenGL model exists that works the same way as Direct3D and this is generally thought to provide a more realistic effect. For more details, including formulae that describe the lighting process, see the current GL specification. At the time of writing this could be found at: OpenGL (Section 2.13.1). While it is possible to support more than 8 light sources simultaneously, OpenGL only guarantees support for 8 lights and applying more than 8 lights to an object tends (as the contributions from all the lights are summed) to result in one thing - white! Games, as in films and TV, use more dramatic lighting, which comes from using one or two powerful, tinted lights within a scene for global illumination, while using other highly localised light sources to provide additional special effects. Applications can easily determine the most important light sources to apply to each individual object and will use many light sources within a scene without needing more than 8 for any single object.
Figure 3 Figure 3 shows dramatic lighting as used in films. This is the classic example of dramatic lighting, very frequently seen in film and TV production. A blue-white saturating light and a warm light are applied to separate halves of the object leaving a dark band in between. Go to Part III
|
|||
Copyright © 1997 - 2000 COMBATSIM.COM, INC. All Rights Reserved. Last Updated September 15th, 1999 |