This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

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.

See also

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 for selected objects can be generated automatically using a Lightmap Generation Tool.

Lightmaps can also 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.
    The LightMix option enables using two additional lightmaps, besides the basic one, for the same materials and at the same time. It allows to add the locally baked lights, or to draw the lighting state of transition between the day and the night.
  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.
    If LightMix is chosen, each of the three lightmaps have their own scale and can be tweaked separately.
Last update: 2017-07-03
Build: ()