Specials: Making games mimic the human eye with motion blue, depth of field and more.
Depth fog Ч You may have had the experience of waking up in the morning and looking out at a landscape and seeing distant hills or buildings in a haze that makes them less distinct. What's happening is the sunlight is reflecting off of the dust particles that naturally hang in the air, refracting the light a bit. The further an object is from you, the more dust there is, so the more pronounced the effect becomes. The photo of cars and people in the street was taken at the end of a bright, sunny day, in the direction of the setting sun. The trees on the right side of the picture clearly show the effects of haze: the closest ones are greenest, while the color of further ones are more and more subdued.
Used in this way, fog can enhance the realism of a game, since it replicates scenes in ways we're used to seeing every day. Fog can also help enhance game performance since it culls out details in the distance, making less work for the video card. Just about every game will have some sort of
clipping plane beyond which no faraway item will be drawn to the screen. Sometimes the implementation is less than ideal, and you can see items popping into the landscape suddenly when they come within range of the camera. Fog can be used to hide this jarring pop-in effect.
Related to fog are
volumetric lighting effects, game designers' attempts to replicate what we see when light comes in through a window or cloud and appears to have a physical presence. It's caused by the same effect as fog: the light reflects off of particles suspended in the air. One easy way this has been created in games in the past is with a simple static mesh with a partially transparent texture that resembles a light beam. Position the mesh, add some light to make it glow, and there you have itЧvolumetric light.
Bloom is a related effect, since it deals with the rendering of intense light. In the above picture, there's a bit of bloom at the point where the beams of light pass down from the cupola into the main body of the church. The light coming into the building is so much stronger than the ambient light inside the building that it overpowers the interior light and seems to wash over the edges of the cupola. At one time, this was rendered in games in a way similar to the volumetric lighting technique described aboveЧan image could be placed in front of a light to give it the appearance of bloom around the light source itself. Now, bloom can be rendered dynamically using shaders. The accompanying screen shows a bloom effect from Call of Duty 4 in which the light from the fires in front of the characters blooms around the edges of their body to create a slight glow effect.
Bloom can depend on another technique called
high dynamic range (HDR) lighting. HDR lighting first appeared at the consumer level in Valve's
Lost Coast demo, where it was used to add intensity to sunlight and light entering through windows in a cathedral scene. Previously, games could only render a certain range of light and color based on how graphics hardware dealt with light brightness. HDR light allows for brighter light and darker shadows while still maintaining visual details within those areas. It also allows for stronger light reflecting off of a surface (like with bloom) or for strong light passing through partially transparent objects like the stained glass windows in Lost Coast. The split screenshot on the beach in Lost Coast clearly shows the difference between older lighting effects on the left and HDR lighting on the right. The shine on the water and sand is clearly brighter on the right than the left. The sun itself is also much more intense, with the left half looking like it probably uses an artificial bloom involving some fancy footwork from the art department. It's a nice effect, but nowhere near as intense as the HDR version.