shown in other instead.
The most popular method of precomputed lighting is using lightmaps. A lightmap is a texture which contains lighting values for a part of the scene. Lightmaps are precomputed and then combined with the textures they were created for, usually it is done using multitexturing. Lightmaps can be downsized and, therefore, should not be of the same size (in pixels) as the original texture to give good visual results. Light sources that you define will be fixed since the moment of creation.
The advantages of lightmaps are the following:
- Real-time performance is not affected by the number of light sources. There can be as many of them, as you need.
- Light sources can be of any form, size, and kind.
- Global illumination can be easily implemented.
But on the flip side, this approach has important disadvantages:
- It requires more textures, and, moreover, you will need to create unique UV maps, since different surfaces are usually differently lit though they may use the same texture.
- It can be used only for static objects. So, some dynamic lighting for moving objects is still required, and it may be not that easy to seamlessly combine the two of them.
- Calculating lightmaps may take a rather long time.
- Advanced shading techniques do not work (bump-mapping, specular mapping, glossiness, and so on).
Setting a Lightmap
Lightmaps can be assigned manually. In this case, a light map is set separately for each material (the parent one, at least, and that is why the material hierarchy is important). The following steps should be taken:
- On the States tab of the Materials settings, choose the lightmap for the Ambient pass in the drop-down box.
- On the Textures tab, specify the paths to the lightmap(s).
- On the Parameters tab, the Scale option defines the intensity of lightmap lighting.