Lighting, Fog, and Background

Lighting, Fog, and Background

Chi Chung Ko (National University of Singapore, Singapore) and Chang Dong Cheng (CCS Automation PTE LTD, Singapore)
Copyright: © 2009 |Pages: 18
DOI: 10.4018/978-1-59904-789-8.ch006
OnDemand PDF Download:


How the properties of virtual 3D objects can be specified and defined has been discussed in earlier chapters. However, how a certain virtual object will appear to the user will in general depends also on human visual impression and perception, which depends to a large extent on the lighting used in illumination. As an example, watching a movie in a dark theatre and under direct sunlight will give rise to different feeling and immersion even though the scenes are the same. Thus, in addition to defining the skeleton of a virtual object by using geometry objects in Java 3D in Chapter III, setting the appearance attributes in Chapter IV and applying texture in Chapter V to give a realistic skin to the virtual object, appropriate environmental concerns such as light, background and even fog are often necessary to make the virtual object appear as realistic to the user as possible. In this chapter, we will discuss topics related to the latter environmental issues. The use of proper lighting is thus crucial to ensure that the 3D universe created is realistic in feeling and adds to strong emotional impressions in any application. For this purpose, Java 3D has a variety of light sources that can be selected and tailored to different scenarios. Technically, light rays are not rendered. In fact, their effects will only become visible once they hit an object and reflect to the viewer. Of course, as with any object in the real world, the reflection depends on the material attributes of the objects. In this chapter, we will discuss the use of different types of light source and their effects after describing the lighting properties or materials of visual objects. We will then outline the use of fogging techniques to turn a hard and straight computer image into a more realistic and smoother scene before discussing methods for immersing active visual objects in a background.
Chapter Preview


The use of the material class has been discussed in Chapter III on appearance. Basically, four components, ambient, emissive, diffuse, specular and shininess, are involved in specifying a material.

Emissive corresponds to the color of the material that will be emitted, and is independent of other external light color and intensity. Ambient is associated with reflection from ambient light sources, specular and shininess are associated with highlight and strong reflections, while diffuse corresponds to normal reflection from diffused sources. Figure 1 gives a summary on how the various material components can be specified.

Figure 1.

Specifying material

Note, however, that the material appearance of an object under various light sources will be properly seen only after setting the normal of the object properly. This is because the reflection of light is with respect to the normal direction, and changing the normal direction will affect the direction of the reflected lights.

Figure 2 illustrates the concepts of face normal and vertex normal, using a pyramid as an example. For the triangular face formed with vertices 1, 2, and 3 or points A, B, and C, the face normal will be the cross product of the vectors AC and AB. On the other hand, the vertex normal is the sum of all the normals of the faces that intercept to form the vertex.

Figure 2.

Face normal and vertex normal

The setting of the normal of faces can be carried out manually or automatically using com.sun.j3d.utils.geometry.GeometryInfo and com.sun.j3d.utils.geometry.NormalGenerator. This is illustrated in the examples in Figure 3.

Figure 3.

Setting the normal manually and automatically

To achieve special effects such as bumping, the normal can be set manually so that it becomes slanted as shown in Figure 4. As illustrated, the direction of the reflected ray will be changed correspondingly, leading to interesting visual effects.

Figure 4.

Baising of normal

Complete Chapter List

Search this Book: