Tuesday 19 November 2013

Lights! And effects that have to do with light!

lights! Along with cameras, lights are integral to video games. You can have all the cameras you want but if you don't have at least one light source you wont see anything but darkness, which is not what you want (unless your game is called "You see nothing but darkness", in which case, its perfect!). Though allowing the player to see is not light's only use, lights can be used, and often are, to establish mood. Anything from wild happiness to creeping terror, lights can make it happen.

candles make everything creepier 

One technique aimed at providing more realistic or at the very least interesting light is HDR or High Dynamic Range lighting. With HDR you could take the range of light beyond , which was (more or less) the limit. This allowed for much higher contrast between light and darkness, creating the effects such as that blurry bright light that you see when you stay in a dark area and look out into a very bright area.


It created this effect by calculating the lighting without making sure that the values stayed within the 0 to 1 range and then stored in a file format that allowed this. Then before the frame is displayed on screen the lighting underwent a process called "tone mapping" which then scaled the intensity of the light to within ability of the TV or monitor or other image viewing machine.


(Ooh just look at those lighting effects! The latest in technology!)

Another technique is called Global Illumination. Well, Global Illumination can be thought of more as a class, incorporating a few techniques to provide the desired effect. But what is global illumination about? Well, it involves techniques that take into account how light effects two or more objects and how the residual light from the objects effects the other objects in the scene, all this in relation to the camera.

Global illumination includes quite a few techniques, the most prevalent ones being those that produced shadows because you can't have light without shadows, it would be weird. One technique used to produce shadows is called "shadow volumes". This technique involves calculating the rays of light emanating from the light source, from the light source's perspective, to each of the objects in the scene, especially their edges (this can be done by shooting rays from the light source through the vertices of the object). The resulting volume(s) provides shadowed areas. To use these shadows effectively in games a stencil buffer is used which records single digit values for each pixel in a scene depending on whether or not they are lit. Then the scene is rendered without shadow in the frame buffer and coupled with a depth buffer. The stencil buffer, set to all zeros, is then rendered from the camera perspective, each value of the stencil buffer changing. Lit triangles increase the value, unlit triangles decrease the value, and unseen triangles are left at zero. So, on a third rendering pass, all the components of the scene are combined allowing for the shadows to be generated by darkening the areas where the shadows hit using values of the stencil buffer.

This is but one of the many techniques included in global illumination which is but one of the types of lighting possible within games. But all in all one can see the vast possibilities given to developers to produce unique and interesting lighting within games to give us that extra bit of detail that make helps to immerse us in the game.


sources

Gregory, Jason.Game Engine Architecture. Boca Raton: CRC Press, 2009.

http://www.oxmonline.com/files/u10/ds3a_screen_3.jpg

http://www.laurenscorijn.com/wp-content/uploads/2009/08/Farcryhdr.jpg

http://www.youtube.com/watch?v=dKEM5sYnOjE

http://upload.wikimedia.org/wikipedia/en/0/07/Doom3shadows.jpg

http://www.gamerzines.com/wp-content/uploads/2012/09/Moon.jpg

No comments:

Post a Comment