Editing Darkplaces lighting

Jump to: navigation, search

Warning: You are not logged in.

Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
[[File:Darkplaces_gl_lightmaps_2.jpg|400px|thumb|Map with only lighting applied]]
+
{{unfinished}}
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 uses combined lighting model. Several lighting methods are implemented to give best results at cases they are aimed for.
  
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.
+
== Light models ==
 +
Darkplaces using several lighting models, most of them are set globally:
  
This reference will guide you in the deep dungeon of Darkplaces lighting methods, effects, tricks and quirks.
+
* [http://en.wikipedia.org/wiki/Phong_shading Phong] lighting model - generic and default lighting model
 +
* 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
  
'''Important Note'''
+
== Light methods and effects ==
 +
There is 4 lighting methods used in Darkplaces:
  
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.
+
* Vertex lighting - static lighting, aimed at big counts of simple surfaces
 +
* Lightmaps - static lighting, aimed at surfaces that receives shadows from static objects
 +
* Lightgrid - 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
  
==Chapters==
+
Additionaly, Darkplaces supports a number of lighting effects:
<font size=3>
+
* Coronas - aimed to simulate glow around lights, which looks good on small and medium size lights
#[[Darkplaces lighting/Introduction|Introduction]]
+
* Planar shadows - each entity cast one shadow on the floor (or by global vector)
#[[Darkplaces lighting/Lighting model|Lighting model]]
+
* Customized modellight - lightgrid-sampled model lighting could be replaced with QuakeC
#[[Darkplaces lighting/Special effects|Special effects]]
+
* Fog - global fog and global volumeric fog (with height set) are suppored
#[[Darkplaces lighting/Light sources|Light sources]]
+
</font>
+
  
==Appendix==
+
== Shadow mapping vs Stencil shadows ==
<font size=3>
+
[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].
* [[Darkplaces lighting/Additional options|Additional options]]
+
</font>
+
  
==Recommended articles==
+
Shadowmapping have a number of advantages over shadow volume rendering and is considered to replace it:
* [http://www.moddb.com/tutorials/lighting-in-game-environments-the-hows-and-whys Lighting in game environments - the hows and whys]
+
* It is faster to render (especially on complex area maps)
 +
* 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=#030>Fast</font>
 +
| <font color=green>Fastest</font>
 +
| <font color=red>Slow</font>
 +
|-
 +
| Precomputation time
 +
| <font color=green>Small</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>
 +
|-
 +
| 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'''
 +
|-
 +
| Precompulation 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]]

Please note that all contributions to Blood Wiki are considered to be released under the Creative Commons Attribution Share Alike (see BloodWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox