Lightmap

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 +
{{wip}}
 
[[File:Lightmap deluxemap.jpg|thumb|512px|right|Lightmap and Deluxemap of the Kain's mausoleum]]
 
[[File:Lightmap deluxemap.jpg|thumb|512px|right|Lightmap and Deluxemap of the Kain's mausoleum]]
  

Revision as of 23:27, 30 July 2012

Template:Wip

Lightmap and Deluxemap of the Kain's mausoleum

Lightmap is generated texture that contains brightness of a map surface. It is applied additively to the surface texture to simulate lighting. The color values of surface's texture get multiplied by lightmap color. Lightmaps are created each time map is compiled (by a LIGHT phase of the map compiler). In Bloods Omnicide, lightmaps can only store static lightning, no flickering or moving lights (for this ones, dynamic lightsources should be used).

Most part of level lit by lightmaps, only some small places using dynamic lighting. Good map lighting should have wide rande of colors and nicely placed lights that cast correct shadows. Its a good rule to use lightmap to not only light up a level, but add some details to it. There is a bunch of delicate things when working with lightmaps. Good lightmaps are small, looking effective and have no visible artifacts. Basically there is no rules to make a good lightmaps with a first try. It always needs an eye inspection and some practice to make nicely lit levels.

Lightmap resolution

Lightmap resolution is different from the texture resolution. Default luxel (lightmap pixel) size is 8 game units. Higher lightmap resolution = lower luxel scale = more memory overhead. There is a bunch of ways to control lightmap resolution:

  • Global luxel scale (set in map build script)
  • Entity's "_ls" or "_lightmapscale" field (works on func_group too)
  • Material's q3map_lightmapSampleSize (alters default luxel size for this material)

Lowering luxel scale will make lightmap shadows sharper, but leads to larger map filesize, slightly slower rendering and exponentially slower compiles (that at very low scales start to eat up shocking amounts of system memory).

Deluxemapping

In Blood Omnicide, lightmaps comes with interleaved deluxemaps (evens are lightmaps, odds are deluxemaps), which store light directions. This allows for per-pixel lightning effects (such as bumps and gloss) to be rendered for static lighting.

Lightmap types

There are two types of lightmaps - internal and external. Internal lightmaps are 128x128 pixel pages that are stored inside BSP file. External lightmaps are 24-bit TGA images stored outside of BSP file (in map/bspfilename/lightmap_<num>).

Map build script are used to configure whether map should use internal or external lightmaps.

External lightmaps have an advantage - they can be any size (256x256, 512x512, 1024x1024 and up to hardware limits). For big outdoor maps using external large lightmaps results in better packing and lesser map size. Ideally, one map should have exactly one big external lightmap. However, for practical reasons (saving HDD space), often there is 2 external lightmaps or many internal ones (to not mess up maps with many directories).

There is no way to set explicitly what number of lightmaps map will have, it's calculated automatically - if map luxels can be mapped to one lightmap - compiler does it, otherwise it adds a second and more lightmap pages to fit.

Console variables

 r_ambient : adds intensity to lightmap and lightgrid. Positive values makes map brighter (note: manual edit of this cvar via console does not work in Blood Omnicide, as cvar is controlled by gamecode).
 r_fullbright : disables static lighting.

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox