DarkPlaces lighting #3 - Lighting special effects
Author: VorteXSource: http://omnicide.razorwind.ru/wiki/
Special effects
This chapter contains references of various special effects hardcoded in light renderer. These special effects, applied or combined, will help to create a wide range of things, such as: switchable lights, projective lights, sunlight simulation, flickering lights and more.
Coronas
Coronas aimed to simulate glow around dynamic lights, which looks good on small and medium size lights. Coronas are customized per-light (size and brightness) and also can be placed without lights.
? r_coronas : Brightness of corona effects. 0 disables coronas.
? r_coronas_occlusionquery : Fades coronas according to visibility. Bad performance (synchronous rendering), even worse on multi-GPU.
? r_coronas_occlusionquerysize : Size of lightsource for corona occlusion checksum. Usial value is 0.1
Cubemap filtering
A technique for modeling non-uniform light distribution according to direction, for example a lantern may use a cubemap to describe the light emission pattern of the cage around the lantern (as well as soot buildup discoloring the light in certain areas), often also used for softened grate shadows and light shining through a stained glass window (done crudely by texturing the lighting with a cubemap), another good example would be a discolight.
Any dynamic lightsource can have a cubemap attached.
Planar shadows
Simplified global shadows which are cast from entities, not from lights (so planar shadows are just filters, they dont do any lighting math). Planar shadows are either stencil or shadowmapped if shadowmapping is on.
Tip: Planar shadows are used to simulate sunlight in outdoor locations.
? r_shadows : Enable planar shadows cast using lightgrid-stored light direction. When set to 2 always cast the shadows in the certain direction (see below). Shadowmapping only supports r_shadows 2.
? r_shadows_castfrombmodel : Enables shadows cast from bmodels.
? r_shadows_darken : How many shadowed areas will be darkened.
? r_shadows_drawafterrtlighting : Hack to draw fake shadows AFTER realtime lightning is drawn. May be useful for simulating sunlight on large outdoor maps with only one big noshadow rtlight. The price is the less realistic appearance of dynamic light shadows.
? r_shadows_focus : Offset the shadowed area focus (used for shadowed area bounds).
? r_shadows_shadowmapscale : Increases shadowmap quality (multiply global shadowmap precision). Needs shadowmapping ON.
? r_shadows_throwdirection : r_shadows 2 throwing direction. Default is '0 0 -1' (down).
? r_shadows_throwdistance : How far to cast shadows from models. This sets shadowed area bounds for shadowmapping.
Customized ModelLight
Lightgrid sampling (diffuse, ambient and light vector components) can be overridden by Client-side QuakeC. Allows various lighting effects on models (strobing, using different positions for sampling etc.)
Fog
Fog is global. Optionally, height plane and height texture can be defined which will make fog to fade with height.
- density - how much fog to add per distance, this is virtual value. 1 means very strong fog.
- red - red component of fog color
- green - green component of fog color
- blue - blue component of fog color
- alpha - fog effect opacity (default is 1)
- mindist - distance to start applying fog at
- maxdist - maximal distance apply fog at
- top - origin of height plane at worldspace (game units)
- height - fog height fade in game units
- fadetexture - horizontal texture that resembles fading, left pixel if top bright, right is top dark. Can be used for non-linear fading.
Fog are set by console commands:
? fog <density> <red> <green> <blue> [<alpha> <mindist> <maxdist> <top> <height>] : Sets the global fog.
? fog_heighttexture <density> <red> <green> <blue> <alpha> <mindist> <maxdist> <top> <height> <fadetexture> : Sets the global fog with customized fade texture.
Tags: DarkPlaces, quake, tutorial, mapping