Darkplaces lighting

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
m
 
(10 intermediate revisions by one user not shown)
Line 1: Line 1:
{{unfinished}}
+
[[File:Darkplaces_gl_lightmaps_2.jpg|400px|thumb|Map with only lighting applied]]
{{need screenshot}}
+
Lighting is one of the most important and influential elements in level design. It has the power to make or break the visuals, theme and atmosphere. Lighting is just as important as geometry. Without lighting there is no environment but just a group of 3-dimensional objects. Its purpose goes further than just giving the players the ability to see where they are going.
{{grammar}}
+
Darkplaces engine uses combined lighting model. Several lighting methods are implemented to give best results at cases they are aimed for.
+
  
== Light models ==
+
Darkplaces engine combines several lighting techiques in order to get best performance and best looks. Because of that there is lots of options and tricks. Clever usage of them will help designers to make fast-to-render and well themed maps.
Darkplaces using several lighting models, most of them are set globally:
+
  
* [http://en.wikipedia.org/wiki/Phong_shading Phong] lighting model - generic and default lighting model
+
This reference will guide you in the deep dungeon of Darkplaces lighting methods, effects, tricks and quirks.
* Fake light - a developer-only mode which is forced on non-lit maps (ones which was compiled and didnt get LIGHT phase). This is infinite realtime light that is cast from eye position.
+
* Cel shading - a phong lighting model with altered shading.
+
* Fullbright - no lighting applied
+
  
== Light methods and effects ==
+
'''Important Note'''
There is 4 lighting methods used in Darkplaces:
+
  
* [[Vertex lighting]] - static lighting, aimed at big counts of simple surfaces
+
Textures are the base for lighting. Before starting to learn how lighting works, be sure to check out [[Darkplaces material system]] as many of it's concepts and features used by lighting too.
* [[Lightmap | Lightmaps]] - static lighting, aimed at surfaces that receives shadows from static objects
+
* [[Lightgrid]] - static lighting, aimed at moving entities
+
* [[Realtime lighting]] - full 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:
+
==Chapters==
* Coronas - aimed to simulate glow around lights, which looks good on small and medium size lights
+
<font size=3>
* Planar shadows - each entity cast one shadow on the floor (or by global vector)
+
#[[Darkplaces lighting/Introduction|Introduction]]
* Customized modellight - lightgrid-sampled model lighting could be replaced with QuakeC
+
#[[Darkplaces lighting/Lighting model|Lighting model]]
* Fog - global fog and global volumeric fog (with height set) are suppored
+
#[[Darkplaces lighting/Special effects|Special effects]]
 +
#[[Darkplaces lighting/Light sources|Light sources]]
 +
</font>
  
== Shadow mapping vs Stencil shadows ==
+
==Appendix==
[http://en.wikipedia.org/wiki/Shadow_volume Stencil shadow volumes] is a shadow rendering method Darkplaces used in pre-2010. Since 2010 [http://en.wikipedia.org/wiki/Shadow_mapping shadow mapping] was implemented by [http://sauerbraten.org/ Eihrul].
+
<font size=3>
 +
* [[Darkplaces lighting/Additional options|Additional options]]
 +
</font>
  
Shadowmapping have a number of advantages over shadow volume rendering and is considered to replace it:
+
==Recommended articles==
* It is faster to render (especially on complex area maps)
+
* [http://www.moddb.com/tutorials/lighting-in-game-environments-the-hows-and-whys Lighting in game environments - the hows and whys]
* Takes less CPU time (as construction of shadow volumes is not required)
+
* Distance-based LOD (far lights rendered with lower shadowmap resolution)
+
* Shadow edges are not sharp
+
 
+
== Comparison of different lighting methods ==
+
{| width=500 cellspacing=0 cellpadding=3 border=1 style="border-collapse:collapse"
+
! width=40% | Task
+
! width=15% | Vertex<br>lighting
+
! width=15% | Lightmap
+
! width=15% | Lightgrid
+
! width=15% | Realtime lighting
+
|-
+
| Details
+
| <font color=red>Low</font>
+
| <font color=orange>Medium</font>
+
| <font color=red>Low</font>
+
| <font color=green>High</font>
+
|-
+
| Render speed
+
| <font color=green>Fastest</font>
+
| <font color=green>Fast</font>
+
| <font color=green>Fastest</font>
+
| <font color=red>Slow</font>
+
|-
+
| Precomputation time
+
| <font color=green>Short</font>
+
| <font color=red>Long</font>
+
| <font color=orange>Medium</font>
+
| <font color=black>N/A</font>
+
|-
+
| RAM usage
+
| <font color=green>Low</font>
+
| <font color=red>High</font>
+
| <font color=green>Low</font>
+
| <font color=green>Low</font>
+
|-
+
| Shadows
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
|-
+
| Penumbra
+
| <font color=black>N/A</font>
+
| <font color=green>Yes</font>
+
| <font color=black>N/A</font>
+
| <font color=orange>Partial</font>
+
|-
+
| Number of lights
+
| <font color=green>Large</font>
+
| <font color=green>Large</font>
+
| <font color=green>Large</font>
+
| <font color=red>Small</font>
+
|-
+
| colspan=5 | '''Surface-based effects'''
+
|-
+
| Bumpmapping
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
|-
+
| Specular
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
|-
+
| Cubemap filters
+
| <font color=red>No</font>
+
| <font color=orange>Partial</font>
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
|-
+
| Per-light diffuse/ambient/specular scale
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
|-
+
| Non-point 'area' lights
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=red>No</font>
+
|-
+
| Light styles
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
|-
+
| Moving lights
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
|-
+
| colspan=5 | '''Global illumination'''
+
|-
+
| Precomputation time
+
| <font color=orange>Long</font>
+
| <font color=red>Very long</font>
+
| <font color=orange>Long</font>
+
| <font color=black>N/A</font>
+
|-
+
| Rendering speed
+
| <font color=black>N/A</font>
+
| <font color=black>N/A</font>
+
| <font color=black>N/A</font>
+
| <font color=red>Slow</font>
+
|-
+
| Quality
+
| <font color=green>High</font>
+
| <font color=green>High</font>
+
| <font color=green>High</font>
+
| <font color=red>Low</font>
+
|-
+
| colspan=5 | '''Used to light'''
+
|-
+
| Map surfaces
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
|-
+
| Static BModels
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
| <font color=orange>Optional</font>
+
| <font color=green>Yes</font>
+
|-
+
| Moving/rotating BModels
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=orange>Optional</font>
+
| <font color=green>Yes</font>
+
|-
+
| Animated models
+
| <font color=red>No</font>
+
| <font color=red>No</font>
+
| <font color=green>Yes</font>
+
| <font color=green>Yes</font>
+
|}
+
 
+
== Console variables ==
+
{{cvar|r_shadow_realtime_world|Enabled realtime lighting of world lights (stored in external .rtlights file)}}
+
{{cvar|r_shadow_realtime_dlight|Enabled realtime lighting of dynamic lights (created by entities)}}
+
 
+
{{cvar|r_shadow_*|A group of cvars to control realtime lighting}}
+
{{cvar|r_shadow_shadowmapping|Enables shadowmapping which replaces default shadow volume-based lighting}}
+
{{cvar|r_shadow_shadowmapping_*|A group of cvars to control shadowmapping}}
+
{{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 <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 <nowiki>(bright blue = lots of passes, slow)</nowiki>. Only matters if using shadow volumes.}}
+
  
 +
__NOTOC__
 
[[Category:Darkplaces engine]]
 
[[Category:Darkplaces engine]]

Latest revision as of 17:51, 9 August 2012

Map with only lighting applied

Lighting is one of the most important and influential elements in level design. It has the power to make or break the visuals, theme and atmosphere. Lighting is just as important as geometry. Without lighting there is no environment but just a group of 3-dimensional objects. Its purpose goes further than just giving the players the ability to see where they are going.

Darkplaces engine combines several lighting techiques in order to get best performance and best looks. Because of that there is lots of options and tricks. Clever usage of them will help designers to make fast-to-render and well themed maps.

This reference will guide you in the deep dungeon of Darkplaces lighting methods, effects, tricks and quirks.

Important Note

Textures are the base for lighting. Before starting to learn how lighting works, be sure to check out Darkplaces material system as many of it's concepts and features used by lighting too.

[edit] Chapters

  1. Introduction
  2. Lighting model
  3. Special effects
  4. Light sources

[edit] Appendix

[edit] Recommended articles

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox