< Zurück | Inhalt | Weiter >

10.1.4 What about shadows?

Note that the discussion has been devoid of any mention of shadows cast by objects onto other objects in the scene. This is because there is no built−in support for automatic shadow calculation in Java 3D or the lower level rendering APIs such as OpenGL or Direct3D.

Although this often comes as a surprise and a disappointment to many people new to rendering APIs, if you

consider how you might go about calculating shadows for arbitrary 3D scenes, it quickly becomes apparent that a general purpose algorithm is unsuitable for interactive 3D graphics. The sheer amount of calculations that need to be performed means that application−specific cheats have to be developed that are able to mimic some of the effects of shadow casting. Lightweight shadow calculation algorithms are available in the OpenGL literature.

Realistic effects such as reflection, refraction, and shadows are best left to noninteractive applications that can make use of ray−tracing techniques. These techniques follow individual light rays as they bounce around the scene, having their color modified along the way, until they finally intersect with a pixel for display.