Lightmap
Encyclopedia
A lightmap is a data structure
Data structure
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...

 which contains the brightness of surfaces in 3d graphics applications such as video games. Lightmaps are precomputed and used for static objects. Quake was the first computer game to use lightmaps to augment rendering
Scanline rendering
Scanline rendering is an algorithm for visible surface determination, in 3D computer graphics,that works on a row-by-row basis rather than a polygon-by-polygon or pixel-by-pixel basis...

. Before lightmaps were invented, realtime applications relied purely on Gouraud shading
Gouraud shading
Gouraud shading, named after Henri Gouraud, is an interpolation method used in computer graphics to produce continuous shading of surfaces represented by polygon meshes...

 to interpolate vertex lighting for surfaces. This only allowed low frequency lighting information, and could create clipping artifacts close to the camera without perspective-correct interpolation. Discontinuity Meshing was sometimes used especially with radiosity
Radiosity
Radiosity is a global illumination algorithm used in 3D computer graphics rendering. Radiosity is an application of the finite element method to solving the rendering equation for scenes with purely diffuse surfaces...

 solutions to adaptively improve the resolution of vertex lighting information, however the additional cost in primitive setup for realtime rasterization was generally prohibitive. John Carmack's Quake software rasterizer used surface caching
Surface caching
Surface caching is a computer graphics technique pioneered by John Carmack, first used in the computer game Quake to apply lightmaps to level geometry. Carmack's technique was to combine lighting information with surface textures in texture-space when primitives became visible , exploiting...

 to apply lighting calculations in texture space once when polygons initially appear within the view-frustum (effectively creating temporary 'lit' versions of the currently visible textures as the viewer negotiated the scene).
As consumer 3d graphics hardware capable of multitexturing became more popular, engines began to combine light-maps in realtime as a secondary "multiply-blend" texture layer.
They are particularly suited to urban and indoor environments with a large planar surfaces.

Limitations

Lightmaps are scaled using lumels (lumination elements). The smaller the lumels, and therefore the more of them present in the image, the higher the resolution
Image resolution
Image resolution is an umbrella term that describes the detail an image holds. The term applies to raster digital images, film images, and other types of images. Higher resolution means more image detail....

 (and visual quality), at the price of game speed and performance. For example, a lightmap scale of 4 lumels per world unit would give a lower quality than a scale of 16 lumels per world unit. It's important for level design
Level design
Level design, environment design or game mapping is a discipline of game development involving creation of video game levels—locales, stages, or missions. This is commonly done using level editor, a game development software designed for building levels; however some games feature built-in...

ers to make a compromise between performance and quality. If a high lumel per world unit scale is set too frequently then the game may use up too much system resources and affect the performance negatively. Lumel size can also be limited by the amount of disk storage space or download time (for the map) or texture memory (for the 3D engine itself) available, although some games attempt to pack multiple lightmaps together to help circumvent these limitations.

Lightmap resolution and scale are two different things. The resolution is the area, in pixels, available for storing one or more surface's lightmaps. The number of individual surfaces that can fit on a lightmap is determined by the scale. Lower scale values, means higher quality and more space taken on a lightmap. Higher scale values, means lower quality and less space taken. A surface can have a lightmap that has the same area, so a 1:1 ratio, or smaller, so the lightmap is stretched to fit.

Lightmaps in games are usually colored texture maps, or per vertex colors. They are usually flat, without information about the light's direction , whilst some game engines use multiple lightmaps to provide approximate directional information to combine with normal-maps. Lightmaps may also store separate precalculated components of lighting information for semi-dynamic lighting with shaders, such as ambient-occlusion & sunlight shadowing.

Creation

When creating lightmaps, any lighting model may be used, because the lighting is entirely precomputed and real-time performance is not always a necessity. A variety of techniques including Ambient Occlusion
Ambient occlusion
Ambient occlusion is a shading method used in 3D computer graphics which helps add realism to local reflection models by taking into account attenuation of light due to occlusion...

, direct lighting with sampled shadow edges, and full Radiosity (3D computer graphics) bounce light solutions are typically used.
Modern 3d packages include specific plugins for applying light-map UV-coordinates, atlas-ing multiple surfaces into single texture sheets, and rendering the maps themselves. Alternatively game engine pipelines may include custom lightmap creation tools.
An additional consideration is the use of compressed DXT textures which are subject to blocking artefacts - individual surfaces must not collide on 4x4 texel chunks for best results.

In all cases, soft shadows for static geometry are possible if simple occlusion tests (such as basic ray-tracing) are used to determine which lumels are visible to the light. However, the actual softness of the shadows is determined by how the engine interpolates the lumel data across a surface, and can result in a pixelated look if the lumels are too large. See texture filtering
Texture filtering
In computer graphics, texture filtering or texture smoothing is the method used to determine the texture color for a texture mapped pixel, using the colors of nearby texels . Mathematically, texture filtering is a type of anti-aliasing, but it filters out high frequencies from the texture fill...

.

Lightmaps can also be calculated in real-time for good quality colored lighting effects that are not prone to the defects of Gouraud shading, although shadow creation must still be done using another method such as stencil shadow volumes or shadow mapping
Shadow mapping
Shadow mapping or projective shadowing is a process by which shadows are added to 3D computer graphics. This concept was introduced by Lance Williams in 1978, in a paper entitled "Casting curved shadows on curved surfaces"...

, as real-time ray-tracing is still too slow to perform on modern hardware in most 3D engines.

Photon mapping
Photon mapping
In computer graphics, photon mapping is a two-pass global illumination algorithm developed by Henrik Wann Jensen that solves the rendering equation. Rays from the light source and rays from the camera are traced independently until some termination criterion is met, then they are connected in a...

 can be used to calculate global illumination for lightmaps.

See also

  • Shader
    Shader
    In the field of computer graphics, a shader is a computer program that is used primarily to calculate rendering effects on graphics hardware with a high degree of flexibility...

  • Discontinuity Meshing
  • SSAO
    Screen Space Ambient Occlusion
    Screen Space Ambient Occlusion is a rendering technique for efficiently approximating the well-known computer graphics ambient occlusion effect in real time...

  • Texture mapping
    Texture mapping
    Texture mapping is a method for adding detail, surface texture , or color to a computer-generated graphic or 3D model. Its application to 3D graphics was pioneered by Dr Edwin Catmull in his Ph.D. thesis of 1974.-Texture mapping:...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK