[Future Technology Research Index] [SGI Tech/Advice Index] [Nintendo64 Tech Info Index]


[WhatsNew] [Intro] [Sys Desc] [PR] [CPU] [RCP] [GFX] [Polygons] [MIPS/MFLOPS] [Res/Video] [FPS]

Ian's SGI Depot: FOR SALE! SGI Systems, Parts, Spares and Upgrades

(check my current auctions!)
[<-- Load Management] [Main Index -->]


Spotlights, Pointlights, Directional Lights, etc.

There are different kinds of lights and different types of lighting properties inherant to objects.

[Landscape with
directional light] The simplest light is a directional light, or infinite light. This is where the light rays are, to all intents and purposes, parallel (eg. light from the Sun). The computations required for directional lights are considerably less than other types of light source because the angle at which any ray is approaching an object is always the same, thus the angle at which the light strikes any vertex is the same (initial lighting values are always calculated at object vertices first). Thus, one can save time if two different vertices happen to be the same. For other types of light source, light rays will always strike different vertices at different angles, so lighting calculations have to be done separately for every vertex. Also, for flat surfaces affected by a directional light, the degree of shading will be the same right across the surface - an effect that does not happen with other types of light source. In the image above, a single white directional light, placed toward the lower left of the scene, lights up the landscape, producing shadows to the right of hillsides.

[Landscape with point
light] A pointlight is defined to be a light source which emanates from a single point in space equally in all directions; for example an arc lamp, or an emergency signal flare fired into the sky from a ship in distress. In the image shown here on the right, a single white point light has been placed in the middle of the scene, producing shadows wherever the point light cannot directly illuminate.

Several N64 games use point lights, eg. Forsaken uses point lights to illuminate one's surroundings whenever a projectile weapon is fired. An example PC game that uses point lights is Quake2 (firing the simple blaster gun into a dark corner shows the effect quite well), so I expect N64 Quake2 (when it is released) will use the same effect.

Note that if a point light is modeled properly, moving it further and further away from a scene should slowly decrease the amount of light falling on the scene (this is because the light rays are not parallel).

[Landscape with
spotlight] A spotlight is a light source which has a cone of effect, eg. a desk lamp or a torch. Like a directional light, it has a basic direction, but it also has a defined conic volume in which its light can fall. The angle of the cone determines how much of the scene is illuminated. Spotlights can also have a drop-off rate; this is the degree to which light nearer the edge of the cone becomes less and less bright compared to light at the center. eg. for a torch beam, directly ahead is the brightest point while to either side the light becomes dimmer usually until there is very little illumination (high drop off rate). Compare this to a stage light, where the cone of illumination is usually fairly constant from the centre to its edge (low drop off rate).

In the image shown above-left, the landscape is illuminated by a single white spotlight, positioned to the left of the scene and pointing downwards to the right. The light has a moderately wide cone of effect (around 60 degrees), but there is no drop-off rate defined, so the edges of the light cone are just as bright as the center of the light cone. The left-hand edge of the cone appears jagged because of the low number of polygons used to construct the landscape (the entire triangle mesh is only 100 by 100). Examine the two main hills in the scene: the shadows on the right faces of the two hills are falling at different angles.


Pointlights and spotlights are local light sources, ie. they are usually close to the observer (as opposed to a directional light which is assumed to be infinitely far away). As a result, the angle between the light source and the normals of the various affected surfaces can change dramatically from one surface to the next, which also means that identical normals in space from different objects will have different angles between them and the light source.

In practical terms, this means that having more than one local light source in a scene incurs many more calculations since each vertex must have lighting calculations performed upon it for each local light in the scene. This becomes especially complex when the colour nature of the light and/or the object is defined to vary across the scene, eg. imagine three spotlights (red, green and blue) all illuminating a pool of water that has been coloured to look like spilled gasoline (which as you know resembles rainbow colours).

[Landscape with 3
lights] The image to the right shows the effect of multiple lights in a scene. The landscape now includes:

The combined effect looks distinctly strange...

Whenever possible, game designers will use directional lights. Sometimes, one might think that a local light must be used (eg. car head lamp) but in practice one can often get away with using clever texture effects, eg. a bright, partially transparent white cone texture, such as is used in the Library level of Goldeneye, or in Top Gear Rally (TGR) for all the car headlights. Actually, TGR uses several such textures to produce a more believable effect.

Some types of real-world light can be hard to model, eg. flourescent lights. This is because the light is not being emitted from a simple single point, or as a conveniently defined cone. Rather, the light is being diffusely emitted from all parts of what is usually a large object, eg. a long rectangular smoke-glass light box. Such lights never produce shadows with sharp edges and so are hard to model in computer graphics. In a computer game, one could probably cheat by having an object with emissive colour and two spotlights, one at each end of the object - this would produce the appropriate shadows, but would not be as complex as modeling a real flourescent light.

Note: one can simulate a spotlight source using a projected texture. This is where a texture that looks like a spotlight cone is projected into a scene and mapped onto any surface it hits. Obviously, genuine lighting calculations are not being performed in this case, but the results can be surprisingly effective.


Here is some information on specular lights which I typed up as part of an email response to a question I received:

The following is an extract from:

  Computer Graphics: Principles and Practice (2nd Edition)
  Foley, van Dam, Feiner and Hughes
  Addison Wesley, 1990, ISBN: 0-201-12110-7

Section 16.1.4. Specular Reflection (pp. 728)

Specular reflection can be observed on any shiny surface. Illuminate an apple with a bright white light: the highlight is caused by specular reflection, whereas the light reflected from the rest of the apple is the result of diffuse reflection. Also note that, at the highlight, the apple appears to be not red, but white, the colour of the incident light. Objects such as waxed apples or shiny plastics have a transparent surface; plastics, for example, are typically composed of pigment particles embedded in a transparent material. Light specularly reflected from the colorless surface has much the same color as that of the light source.

                      _       _      _
                      L       N      R
                       \      |      /
                        \     |     /       _
       Fig. 16.8         \    |    /        V
   Specular Relfection    \ b | b /      _.'
                           \  |  / a  _.'
                            \ | /  _.'
                             \|/.-'
                        _...-----..._

Now move your head and notice how the highlight also moves. It does so because shiny surfaces reflect light unequally in different directions; on a perfectly shiny surface, such as a perfect mirror, light is reflected only in the direction of reflection R, which is L mirrored about N. Thus the viewer can see specularly reflected light from a mirror only when the angle a in Fig. 16.8 is zero; a is the angle between R and the direction to the viewpoint V.

(end of extract)

The book then goes on to discuss the Phong illumination model, created by Phong Bui-Tuong, "... for nonperfect reflectors, such as the apple."

The various equations are given, a key point being that, "... the color of the specular component in Phong's illumination model is not dependent on any material property; thus, this model does a good job of modeling specular reflections from plastic surfaces."

Phong shading is discussed on pp. 738 (section 16.2.5) as part of the chapter on 'Shading Models for Polygons' (pp. 734). This chapter is already available for reading.

An important point about specular reflection as used in computer games is that Phong calculations are complex. In essence, Phong modeling involves calculating many different lighting values across the surface of each polygon, usually by extrapolating normals and repeating a lighting calculation for each new normal. This is very time consuming. Some consoles, like the Nintendo64, probably support Phong lighting directly, but the extra detail it gives is normally not worth the extra effort (is one going to notice the difference in a fast moving game?). A much more common approach is to use the Phong lighting model to calculate colour values at polygon vertices and then use Gouraud shading to extrapolate those colour values across the surface between vertices. This is better than Gouraud shading on its own and is used extensively by graphics cards manufacturers as an easy benchmarking marketing con trick: '1 million Phong-lighted polygons/sec' is very different and alot easier to do than '1 million Phong-shaded polygons/sec' (the former is using Gouraud shading with Phong-lit vertices, the latter is using the much more complex Phong shading).

An important point is that, if one is using Phong lighting with Gouraud shading, the results are greatly improved with more polygons (because there are more vertices). However, since texturing is common and easy to do, it makes sense to use texture wherever possible since this can reduce the required number of polygons by a factor of as much as 200 (compared to flat shading). Even so, some surfaces, like plastics, are not easily represented by textures and in these cases specular lighting is important (sometimes, one uses both, eg. a plastic coated patterned beach ball). To cut down on the calculations required, Phong lighting combined with Gouraud shading is often chosen instead of Phong shading.


[Goldeneye image 1] [Goldeneye image 2] Sometimes, textures can be a very effective way of removing the need for a light source altogether, or at least greatly simplifying the situation. Consider a corridor, with a lamp on the ceiling: in the real world, such a light would be a spot light or emissive/diffuse light such as a flourescent lamp, or perhaps a point light for a simple bare light bulb, etc., but not a directional light. For a game, one could use a spot light (or whatever) as normal, but this is computationally expensive, especially if, for example, a character enters the area carrying a torch (two light sources, double the calculations for every affected vertex).

A different approach uses textures instead. The textures for the walls, ceiling and floor are created with the appropriate lighting from the ceiling lamp already included (ie. the lit walls, ceiling and floor are part of the texture and not the result of any lighting calculations going on when the game is in motion). When playing the game, the corridor will look very nice indeed; when one moves though the corridor, the lamp can be made to affect, say, the gun one is carrying by defining the lamp to be a simple downward directional light that has a fade cut-off value (fades away when one moves away from the area). The scene database can be organised so that such a 'fake' light only affects the gun and not the rest of the scene which has already been 'lit' by using textures. The scenery looks great, the lamp affects carried objects, the calculations are much simpler (identical lighting normals for every vertex) and the player won't notice the difference (the image shown above-left, from Goldeneye, is a perfect example of where a texture is used to show lighting).

Even better, if one then decided to shoot the lamp, the missing light can be modeled very easily just by using a different set of textures for the walls, ceiling and floor, and deactivating the directional light from above. Similarly, a partially damaged 'flickering' light can be achieved simply by switching repeatedly between texture sets. Games such as Quake and Goldeneye use these techniques extensively, although it's noticeable that Goldeneye does not often have separate textures available for walls, etc. after a lamp has been destroyed which sometimes spoils the effect of being able to shoot a light in the first place - an example of this is shown in the above-right image where I have destroyed the wall lamp, but the lit-texture effect has not changed. Perhaps the extra textures are not included because of space considerations. It will be interesting to see whether Perfect Dark employs this lit-texture technique properly.

However, one disadvantage of the texturing method described above is that the player may notice inconsistencies between the fake lamp light and the resultant lighting on a carried object such as a gun when the player is close to a wall. In the heat of the action though, it's unlikely the player will notice.

In time, as compute power becomes greater, the need for such careful programming techniques to increase game speed will lessen and designers will be able to offer full texuring, Gouraud, Phong, etc. lighting all round, whatever gives the best realism. On the other hand, whatever compute power is available, it's likely that designers will always try and push the game hardware to the limits, so perhaps these space-saving, speed-increasing techniques will always be used to some degree.


[<-- Load Management] [Main Index -->]

Ian's SGI Depot: FOR SALE! SGI Systems, Parts, Spares and Upgrades

(check my current auctions!)
[WhatsNew] [Intro] [Sys Desc] [PR] [CPU] [RCP] [GFX] [Polygons] [MIPS/MFLOPS] [Res/Video] [FPS]
[Future Technology Research Index] [SGI Tech/Advice Index] [Nintendo64 Tech Info Index]