Lightmaps

Lightmaps are a combination of data storing the static "baked" lighting of a BSP. Since the BSP does not move, and many shadow-casting objects like scenery have fixed locations, base global illumination can be precalculated. Dynamic objects will cast shadow-mapped shadows and be lit using lightmap data at runtime.

Lightmap data in the BSP is comprised of both:

  • A reference to a generated bitmap containing diffuse lighting as texture sheets.
  • Mesh data which stores local lighting information for dynamic objects, among other purposes.

Creation #

The HEK's built-in radiosity process can be run using Tool, LM_Tool, or Sapien. It splits the BSP's render mesh into many fragments depending on shader parameters like simple parameterization and detail level, and UV-maps them to texture sheets. A texture is rendered to apply levels of light to those surfaces.

If higher resolution or greater control of lighting is desired, Aether facilitates texture baking in standalone 3D software.

Sky lights, emissive environment shaders, scenery with lights, and light fixtures can all be used as light sources to illuminate the BSP. If you change any of these inputs, or move any scenery, you must re-run radiosity.

Lighting for dynamic objects #

All objects receive their lighting from the environment using data in the BSP, generated during radiosity. Similar to light probes in other engines, this data encodes the shadow direction and incoming light of locations throughout the BSP.

Only moving objects like units cast real-time shadows; scenery cast shadows in the baked lightmap using the object's collision model rather than its render model, likely because the collision model is stored using a BSP structure which is more efficient to perform lighting calculations with.

Related commands #

  • rasterizer_environment_diffuse_textures 0: Disables diffuse textures in the BSP, showing just the lightmap and specular components.