Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes

Lightmap

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.

Screenshot of a scene with a lightmap

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:

  1. On the States tab of the Materials settings, choose the lightmap for the Ambient pass in the drop-down box.
  2. On the Textures tab, specify the paths to the lightmap(s).
  3. On the Parameters tab, the Scale option defines the intensity of lightmap lighting.
Last update: 2017-07-03