Lightmaps and Dynamic Lighting
From ODF::Wiki
This article should help to explain the differences between two techniques: Lightmaps and Dynamic Lighting.
Contents |
[edit] Lightmaps
(short introduction a la: "A lightmap is a ...". Please also explain, how a lightmap looks - is it only black and white pixels, that represent "black = shadow", white = "light shining here")
[edit] Overview about the 5 types of maps
(describe each with 2 or 3 sentences, please)
- diffuse (color)
Diffuse are the most common type of map, being essential to make all of the models not be solid colors. They consist of the colors that should be on a model.
- normal (bump)
There are actually 2 types of maps here... The older type, bump maps, are gray images that describe the height that a point on the model's face is raised or lowered. After a while it was found that this was limited and normal maps were developed. They use a color image to define the direction that the normal (a line at a 90 degree angle to the face) is pointing at every point is facing. This allows for much better smoothing and better detail than bump maps. The normal map can be from various perspectives, but the most useful for games is the "tangent space normal map" It defines the direction of the normal compared to the direction of the tangent to the face. This is more useful because the model can be rotated and the camera can be moved without the detail being lost.
- spec (shinyness)
Specularity is the reflection of the light off of the object. Specularity maps determine how much of a specular reflection each part of the model has, so that things that may have different types of surfaces may be represented in the same texture. Example of specularity: Smooth plastic and glass are specular, soft rubber and paper tend not to be.
- lightmap (shadow map)
Lightmaps define how much light everywhere gets, and what color the light is. They offer advantages over dynamic lighting in the quality of the calculations and the speed with which they can be displayed. Quality increases with lightmaps are due to being able to use advanced rendering techniques that would take too long to do in real time on each frame.
- Ambiant Occlusion ?
Ambiant Occlusion is an advanced lighting method that takes into account surrounding geometry and ambiant light, making models more defined. If full lightmaps are used an AO map isn't needed, but it can be a nice addition to realtime lighting. Example and more description here: http://en.wikipedia.org/wiki/Ambient_occlusion
[edit] How are lightmaps created?
There are two ways that lightmaps can be created. One is to precalculate lighting at the beginning of each level. This method is basicly a cheating method of realtime lighting, and is only used to improve performance. Good level creators and 3D modeling software (such as blender) also allows the creation of lightmaps. These are preferable as they can use advanced rendering techniques such as soft shadowing and Ambient Occlusion (without needing an AO map)
[edit] Dynamic Lighting
Dynamic lighting uses basic raytracing to determine where a the light from a lamp hits. The distance to the lamps from these points is then determined, a falloff curve is applied (so that points farther from a source get less light, and the light is multiplied by the texture.
Unless I am wrong. I have never done renderer design and don't know if this is 100% accurate.
[edit] Can one combine lightmaps with dynamic lighting?
A simple way to combine them would be to use the shadow buffer to determine what parts are shadowed, determine what the color values for the lights would be there, and then subtract these values from the shadow map values.

