Chapter 4. Global Illumination

[ LiB ]

Chapter 4. Global Illumination

Simulating light in a 3D environment has been the game developer's goal for many years . The different effects that occur in nature must be transformed to algorithms that the computer understands. Transforming the reality of light to a mathematical model is the ultimate goal of researchers.

Global illumination is understanding the nature of light and simulating each effect in a mathematical model. Now of course real-world lighting is so complex that no computer on earth can simulate it fully. They are some aspects of light that are still not yet fully understood . This book covers the physics aspect and the practical aspects of a light scattering in a given model. It will be mostly based on the interaction of light on surfaces seen through the eyes of an observer. But it goes way farther than that.

In a 3-D environment you have all types of objects in the scene. The best way to explain this is to think of a human being in the real world. The human has eyes that record the reflected light on objects that sends the visual information to the brain for processing. The same method of using our eyes to see and observe objects in the world is utilized in the synthetic model. The major advantage of the global illumination algorithm is that it foretells the intensity of light everywhere in the model. This is the light that contributes to the model indirectly in meager amounts or the global lighting in the model that comes from everywhere, thus scattering all around an environment.

NOTE

TIP

The goal of a global illumination algorithm is to simulate a real-world model so realistically that game players can't tell the difference between a synthetic render and a real photograph.

A virtual camera is created also known as an observer that navigates through the scene and records the visual data as a 2D image. Because light is observed from the interaction on surfaces, you must develop robust and realistic methods of copying the physical aspects of light to create synthetic images, which are images that are so perfectly rendered that you can't tell the difference between a synthetic render and a real photograph. Before we get our hands dirty with photon mapping, I want you to know some basic 3D fundamentals for understanding and developing an application. It is essential to know these terms because they are used later on in this book.

For many decades, programmers and mathematicians have been trying to develop rendering techniques that can correctly simulate light scattering in a scene. But almost all of the systems fell short of the goal. Some systems were either too slow or allocated too much memory. Today, Hollywood utilizes high-performance computer-rendering systems that can render full-length movies like Toy Story, Shrek , Ice Age, and Monsters Inc . These movies were a big success at the box office, which implies that Hollywood will be making many more of these types of movies in the years to come. Global illumination is set up by the geometry of the scene, the light sources, the list of materials, and finally the observer/camera. The geometry can be a box, wall, sphere, chair , dog, or car. The light sources can consist of point lights, or directional lights. The materials define the lighting parameters for each object in the scene in order to simulate specific lighting effects. The observer then records the reflected light as an image based on the material properties, scene geometry, and light sources. Look at Figure 4.1 to see the typical components of a scene. The objective for a global illumination algorithm is to foretell the intensity of light at any given point in the scene. You must compute the amount of light leaving each light source and determine the quantity for each object in the scene at any given time.

Figure 4.1. The components of the scene consist of the geometry,materi- als,lights,and the observer.

graphic/04fig01.gif


Simulation in a complex environment such as a room full of objects with unique material properties can be a daunting and painful task if not done correctly. It becomes worse when the overall object count in the model is huge. You must be able to write an application that can render direct and indirect lighting correctly. It should include effects such as specular highlights, translucent surfaces, color -bleeding, and soft shadows. Obviously, some of these terms seem strange to you but don't worry about them because I will cover each one in detail.

Many algorithms have been designed and almost all of them have their flaws when rendering the correct flow of light through a scene. Some algorithms just do simple effects but stray far from the correct mathematics of light scattering. For example, the lighting system that is coded into the current versions of DirectX is far from being mathematically correct. That's why it doesn't look realistic. The lighting algorithms in DirectX are approximations of real lighting to keep the rendering pipeline smooth and fast. Quake Arena and Unreal 2003 did a very good job at using the most DirectX had to offer. This made the game very fast and fun to play.

NOTE

TIP

Tomb Raider 2 was one of the first games that utilized 3D hardware alpha blending techniques.This effect was primarily used on water,where it was transparent to some degree. This added great realism to a game.

Almost all applications output their rendered geometry to a file or to the video card directly. The scene is always rendered using the eyes of the observer looking at the model from a specific direction and standing at some arbitrary position. Normally you would define your geometry from a file and render it using your virtual observer's eyes. State-of-the-art 3D renderers like 3D Studio Max, Lightwave 3D, Maya, and Softimage all follow the same concept of setting up an environment through the materials, objects, lights, and the observer.

The observer is the major element of a scene. The observer records the current position and orientation of the camera as a 2D image. This 2D image is then output to a file for later reference or output to the monitor directly. The object in front of the camera is rendered and recorded in the image. See Figure 4.2.

Figure 4.2. The virtual eyes of the observer generate the final image that is projected on the computer monitor.

graphic/04fig02.gif


You can also render a sequence of still images as an animation. If you choose to render the scene as an animation, you can move the camera around a bit, but you must process all the camera movements before render time. That is the problem with 3D renderersyou must process everything before render time. On the other hand, games let you move around and render in real-time. That's the secret to their magic. The goal of any game programmer is to write a game that has high-resolution graphics (millions of colors and big in width and height) and is fun to play.

[ LiB ]


Focus On Photon Mapping
Focus On Photon Mapping (Premier Press Game Development)
ISBN: 1592000088
EAN: 2147483647
Year: 2005
Pages: 128
Authors: Marlon John

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net