D3DBook:Introduction to Shadows

From GDWiki
Jump to: navigation, search

Introduction to Shadows

Image:Pvgps3_1_lamppost.png

Shadows are an extremely important effect in modern real-time graphics simulations. Without any kind of shadow approximations, a 3D scene seems quite lifeless and lacking in depth. This is due to the fact that human vision system regards shadows as a strong cue of depth, in addition to the normal stereo vision that our two eyes provide.

In real life, shadows are produced as a side effect of photons, “particles” of light, being obstructed – thus absorbed or reflected away - by an opaque object. A good example is a street lamp on a bright summer evening. As the sun shines on the lamp post, a long projected silhouette of the post is seen on the street, in opposite side of it from sun. As photons crash onto the lamp post, the side of it that faces the sun is lit by the reflection of the photons of the sunlight. Without the lamp post, the said photons would go all the way to the pavement; with the lamp post in the place, the photon flow is cut before the light reflects off the street, thus depriving the street from light on the path of obstruction.

An ideal simulation of the process that forms the shadow would be to trace all the photons of the scene to all light receptors of the observer (or in computer terms, pixels of the frame buffer), and performing atomic-scale reflection and absorption calculations for each particle of the scene while doing that. However, this poses a problem: modeling all photon interactions with material particles, even in a simple scene, is very expensive in computational terms; it would take infinite-like amounts of memory just to store the photon starting points (or light sources), not to mention each particle of the media that the said photons are going to collide to. Add that to the fact that the mathematics for quantum-scale particle interaction calculations aren’t exactly of the light sort either. Multiply these astronomical figures with the fact that you need to do the same process for each light sensor (or pixel) of the observer, and you can figure that real shadows simply cannot be simulated in purely physical manner, at least on existing computing architectures.

In real-time computer graphics, shadows have to be approximated as it is not nearly feasible on current graphics technologies to simulate the real photon flow with sufficient accuracy to fool the eye, while at the same time run the simulation in frame rates sufficient to fool the brain to see the movement of the scene and it’s object without noticing the discrete frames of the simulation.

In the following shadow topics, we will take a look at two common techniques used to approximate shadows in real time on Direct3D 10 hardware, a smaller look at ray-tracing approximation of shadows, and do a comparison between these techniques and “real” behavior of shadows.

If you want to read more on approximation of the light reflection and absorption – that is, what happens when the photons would reflect from the occluder - please refer to the chapter “Lighting models” in this book.

Personal tools