Darkplaces lighting

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
(Console variables)
Line 104: Line 104:
 
{{cvar|r_shadow_shadowmapping_*|A group of cvars to control shadowmapping}}
 
{{cvar|r_shadow_shadowmapping_*|A group of cvars to control shadowmapping}}
 
{{cvar|r_shadows_*|A group of cvars to control planar shadows}}
 
{{cvar|r_shadows_*|A group of cvars to control planar shadows}}
{{cvar|r_showlighting|Show areas lit by dynamic lightsources. Useful for finding out why some areas of the map render slowly (bright orange = lots of passes, slow)}}
+
{{cvar|r_showlighting|Show areas lit by dynamic lightsources. Useful for finding out why some areas of the map render slowly <nowiki>(bright orange = lots of passes, slow)</nowiki>}}
{{cvar|r_showshadows|Show areas covered by shadow volumes. Useful for finding out why some areas of the map render slowly (bright blue = lots of passes, slow). Only matters if using shadow volumes.}}
+
{{cvar|r_showshadows|Show areas covered by shadow volumes. Useful for finding out why some areas of the map render slowly <nowiki>(bright blue = lots of passes, slow)</nowiki>. Only matters if using shadow volumes.}}
  
 
== See also ==
 
== See also ==

Revision as of 15:25, 27 July 2012

Template:Article unfinished Darkplaces engine uses combined lighting model. Several lighting methods are implemented to give best results at cases they are aimed for.

Contents

Light methods and effects

There is 4 lighting methods used in Darkplaces:

  • Vertex lighting - low frequency static lighting, aimed at big counts of simple surfaces
  • Lightmaps - high frequency static lighting, aimed at surfaces that receives shadows from static objects
  • Lightgrid - low frequency static lighting, aimed at moving entities
  • Realtime lighting - fully dynamic lighting (each light is a separate pass), aimed at switchable and moving lightsources that lights moving entities

Additionaly, Darkplaces supports a number of lighting effects:

  • Coronas - aimed to simulate glow around lights, which looks good on small and medium size lights
  • Planar shadows - not a lighting but shadowing method where each entity cast one shadow on the floor
  • Customized modellight - lightgrid-sampled model lighting could be replaced in realtime
  • Fog - global fog and global volumeric fog (with height set) are suppored

Light models

Darkplaces using several lighting models, most of them are set globally:

  • Phong lighting model - generic lighting model used on all methods
  • Fake light - a developer-only mode which is forced on non-lit maps (ones which was compiled by didnt get LIGHT phase). This is infinite realtime light that is cast from eye position.
  • Toon shading - a phons lighting model with altered shading.
  • Fullbright - no lighting applied

Shadow mapping vs Stencil shadows

Stencil shadow volumes is a shadow rendering method Darkplaces used in pre-2010. Since 2010 shadow mapping was implemented by Eihrul. Shadowmapping have a number of advantages over shadow volumes and is considered to replace them:

  • It is faster to render (especially on complex area maps)
  • Takes less CPU time (as construction of shadow volumes is not required)
  • Supports LOD (far lights rendered with lower shadowmap resolution)
  • Shadow edges are not ideally sharp

Comparison of different lighting methods

Task Vertex
lighting
Lightmap Lightgrid Realtime lighting
Details Low Medium Low High
Render speed Fastest Fast Fastest Slow
Precomputation time Small Long Medium N/A
RAM usage Low High Low Low
Shadows No Yes No Yes
Light up
Map surfaces Yes Yes No Yes
Static BModels Yes Yes Yes Yes
Moving/rotating BModels No No Yes Yes
Animated models No No Yes Yes

Console variables

 r_shadow_realtime_world : Enabled realtime lighting of world lights (stored in external .rtlights file)
 r_shadow_realtime_dlight : Enabled realtime lighting of dynamic lights (created by entities)
 r_shadow_* : A group of cvars to control realtime lighting
 r_shadow_shadowmapping : Enables shadowmapping which replaces default shadow volume-based lighting
 r_shadow_shadowmapping_* : A group of cvars to control shadowmapping
 r_shadows_* : A group of cvars to control planar shadows
 r_showlighting : Show areas lit by dynamic lightsources. Useful for finding out why some areas of the map render slowly (bright orange = lots of passes, slow)
 r_showshadows : Show areas covered by shadow volumes. Useful for finding out why some areas of the map render slowly (bright blue = lots of passes, slow). Only matters if using shadow volumes.

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox