|
|
(35 intermediate revisions by one user not shown) |
Line 1: |
Line 1: |
− | {{article unfinished}}
| + | [[File:Darkplaces_gl_lightmaps_2.jpg|400px|thumb|Map with only lighting applied]] |
− | Darkplaces engine uses combined lighting model. Several lighting methods are implemented to give best results at cases they are aimed for.
| + | 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. |
| | | |
− | == Light methods and effects ==
| + | 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. |
− | There is 4 lighting methods used in Darkplaces:
| + | |
| | | |
− | * Vertex lighting - low frequency static lighting, aimed at big counts of simple surfaces
| + | This reference will guide you in the deep dungeon of Darkplaces lighting methods, effects, tricks and quirks. |
− | * 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:
| + | '''Important Note''' |
− | * Coronas - aimed to simulate glow around lights, which looks good on small and medium size lights
| + | |
− | * Planar shadows - each entity cast one shadow on the floor (or by global vector)
| + | |
− | * 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 ==
| + | 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. |
− | Darkplaces using several lighting models, most of them are set globally:
| + | |
| | | |
− | * Phong lighting model - generic lighting model used on all methods
| + | ==Chapters== |
− | * 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.
| + | <font size=3> |
− | * Toon shading - a phons lighting model with altered shading.
| + | #[[Darkplaces lighting/Introduction|Introduction]] |
− | * Fullbright - no lighting applied
| + | #[[Darkplaces lighting/Lighting model|Lighting model]] |
| + | #[[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]. Shadowmapping have a number of advantages over shadow volumes and is considered to replace them: | + | <font size=3> |
− | * It is faster to render (especially on complex area maps)
| + | * [[Darkplaces lighting/Additional options|Additional options]] |
− | * Takes less CPU time (as construction of shadow volumes is not required)
| + | </font> |
− | * Supports LOD (far lights rendered with lower shadowmap resolution)
| + | |
− | * Shadow edges are not ideally sharp
| + | |
| | | |
− | == Comparison of different lighting methods == | + | ==Recommended articles== |
− | {| width=500 cellspacing=0 cellpadding=3 border=1 style="border-collapse:collapse"
| + | * [http://www.moddb.com/tutorials/lighting-in-game-environments-the-hows-and-whys Lighting in game environments - the hows and whys] |
− | ! 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=green>Yes</font>
| + | |
− | | <font color=green>Yes</font>
| + | |
− | |-
| + | |
− | | Moving/rotating BModels
| + | |
− | | <font color=red>No</font>
| + | |
− | | <font color=red>No</font>
| + | |
− | | <font color=green>Yes</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.}}
| + | |
− | | + | |
− | == See also ==
| + | |
− | * [[Per-pixel lighting]]
| + | |
| | | |
| + | __NOTOC__ |
| [[Category:Darkplaces engine]] | | [[Category:Darkplaces engine]] |
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.
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.