< Zurück | Inhalt | Weiter >

10.1 Lights

Careful use of lights can make the difference between a flat, unconvincing 3D scene and an atmospheric, immersive virtual reality. The shading that results from applying lighting to a 3D scene provides many of the important visual cues that convey the depth information for the scene.


There are four basic types of light defined in Java 3D and most 3D rendering APIs:


Ambient lights—Applied to the whole scene.

Directional lights—Positioned at infinity and shine in a given direction.

Point lights—Radiating outward from a given point in 3D space within the scene.

Spotlights—Radiating outward from a given point and with a given spread angle, to allow the width of the light’s beam to be specified.


Lights positioned within the scene influence the colors that are applied to surfaces. Lights are not visible entities in themselves, but they affect the colors of the surfaces of objects within the scene. For example, there is no built−in support for displaying shafts of light that illuminate fog or dust before falling onto the surfaces of objects in the scene. Other lighting side effects, like lens−flare, are also not supported. Such visual effects, now commonly seen is 3D games such as Quake, are not implemented in either OpenGL or DirectX and hence not supported in Java 3D.


Once the lights are positioned within the scene, complex lighting equations govern the resulting color and shading of a surface. The result, a rendered shaded surface, relies on many factors, such as:


Surface Properties


angle of surface relative to light sources

material properties: ambient, diffuse, emissive and specular colors, shininess (or gloss) surface simulation: e.g., bumpy or wrinkled

vertex colors transparency

applied texture image

shading model (Lambert, Gouraud, Phong)

Light Properties


position color direction

attenuation: how the intensity of the light decreases with distance concentration

spread angle extent (Bounds)


 

10.1.1 Lighting equations
10.1.2 Normal vectors and lighting
Lambert shading
Gouraud shading
Phong shading
NO NORMALS... NO SHADING
10.1.3 Lighting and material properties
10.1.4 What about shadows?