Editing Darkplaces lighting
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: | ||
− | + | {{unfinished}} | |
− | + | Darkplaces engine uses combined lighting model. Several lighting methods are implemented to give best results at cases they are aimed for. | |
− | Darkplaces | + | == Light models == |
+ | 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 | |
+ | * 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 == | |
+ | There is 4 lighting methods used in Darkplaces: | ||
− | + | * 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 | ||
− | + | 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 - each entity cast one shadow on the floor (or by global vector) | |
− | + | * Customized modellight - lightgrid-sampled model lighting could be replaced by QuakeC code | |
− | + | * Fog - global fog and global volumeric fog (with height set) are suppored | |
− | + | ||
− | + | ||
− | == | + | == Shadow mapping vs Stencil shadows == |
− | + | [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 volume rendering and is considered to replace it: |
− | + | * 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 ideally 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=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]] | ||
− | |||
[[Category:Darkplaces engine]] | [[Category:Darkplaces engine]] |