Editing Darkplaces lighting/Lighting model

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 16: Line 16:
 
* Color Map : base texture (best way to use [[diffuse]] texture)
 
* Color Map : base texture (best way to use [[diffuse]] texture)
 
* Normal Map : texture storing additional surface curvature (optionally, alpha storing height)
 
* Normal Map : texture storing additional surface curvature (optionally, alpha storing height)
* Gloss Map : texture used for specular reflection. Contains gloss color (RGB) and optional exponent multiplier (alpha)
+
* Gloss Map : texture used for specular and containing gloss color (RGB) and optional exponent multiplier (alpha)
 
* Glow Map : texture's local luminance texture, RGB additive blended texture that entirely ignores shading
 
* Glow Map : texture's local luminance texture, RGB additive blended texture that entirely ignores shading
 
* Light Vector : vector of light direction (either calculated for realtime light or got from deluxemap [[lightmap]] component)
 
* Light Vector : vector of light direction (either calculated for realtime light or got from deluxemap [[lightmap]] component)
Line 64: Line 64:
 
{{cvar|r_ambient|Amount of ambient light to be added to all surfaces. Makes level brighter.}}
 
{{cvar|r_ambient|Amount of ambient light to be added to all surfaces. Makes level brighter.}}
  
{{grammar}}
 
 
==Specular==
 
==Specular==
Specular (or gloss) is the mirror-like reflection of light from a surface, in which light from a single incoming direction (a ray) is reflected into a single outgoing direction. Many well-known surfaces (metal, plastic, wood) is recognized by specularity they have.
+
Specular are optional and could be tweaked per-material.  
  
 
Specular offers two parameters to mess with:
 
Specular offers two parameters to mess with:
* Specular multiplier: intensity of specular effect, this could be very high or very low. It is multiplier to gloss texture.
+
* Specular multiplier: intensity of specular effect, this could be very high or very low. It is modifier to gloss RGB.
 
* Specular exponent: how 'sharp' gloss is, high values are used to make texture to be plastic-like, while lower ones are suitable for matte surfaces. Basically its just a modifier to gloss texture's alpha channel (which is forced to 1 if not supplied).
 
* Specular exponent: how 'sharp' gloss is, high values are used to make texture to be plastic-like, while lower ones are suitable for matte surfaces. Basically its just a modifier to gloss texture's alpha channel (which is forced to 1 if not supplied).
  
Line 101: Line 100:
 
{{important|Shadows are quite complex render task, many lights casting many shadows may decrease rendering speed significantly. Map designer should plan his map with this limitation in mind - there should be no situation of many lights being seen from a certain point, or user will experience a game slowdown.}}
 
{{important|Shadows are quite complex render task, many lights casting many shadows may decrease rendering speed significantly. Map designer should plan his map with this limitation in mind - there should be no situation of many lights being seen from a certain point, or user will experience a game slowdown.}}
  
Darkplaces supports two realtime shadowing techniques: stencil shadow volumes and shadow mapping.
+
Darkplaces supports two realtime shadowing techniques.
  
===Stencil shadow volumes===
+
===Stencil shadows===
 
[http://en.wikipedia.org/wiki/Shadow_volume Stencil shadow volumes] is a base shadow rendering method in Darkplaces.  
 
[http://en.wikipedia.org/wiki/Shadow_volume Stencil shadow volumes] is a base shadow rendering method in Darkplaces.  
  
Line 113: Line 112:
 
{{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.}}
 
{{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.}}
  
===Shadow mapping===
+
===Shadowmapping===
In 2010 darkplaces got [http://en.wikipedia.org/wiki/Shadow_mapping shadow mapping] implemented by [http://sauerbraten.org/ Eihrul].  
+
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:
 
Shadowmapping have a number of advantages over shadow volume rendering and is considered to replace it:
Line 121: Line 120:
 
* Takes less CPU time (as construction of shadow volumes is not required)
 
* Takes less CPU time (as construction of shadow volumes is not required)
 
* Distance-based LOD (far lights rendered with lower shadowmap resolution)
 
* Distance-based LOD (far lights rendered with lower shadowmap resolution)
 +
* Shadow edges are not sharp
  
 
{{hidden begin|Console variables}}
 
{{hidden begin|Console variables}}
{{cvar|r_shadow_shadowmapping|Enables shadow mapping}}
+
{{cvar|r_shadow_shadowmapping|Enables shadowmapping}}
 
{{cvar|r_shadow_shadowmapping|Shadowmap [[bias]] parameter (this is multiplied by nearclip * 1024 / lodsize}}
 
{{cvar|r_shadow_shadowmapping|Shadowmap [[bias]] parameter (this is multiplied by nearclip * 1024 / lodsize}}
 
{{cvar|r_shadow_shadowmapping_bordersize|Shadowmap size bias for filtering}}
 
{{cvar|r_shadow_shadowmapping_bordersize|Shadowmap size bias for filtering}}
Line 131: Line 131:
 
{{cvar|r_shadow_shadowmapping_minsize|Shadowmap size limit}}
 
{{cvar|r_shadow_shadowmapping_minsize|Shadowmap size limit}}
 
{{cvar|r_shadow_shadowmapping_nearclip|Shadowmap near clip in world units. Increasing this will make shadow rendering to be more precise (as more bits goes to middle range), at the cost of the small non-shadowed zone around light}}
 
{{cvar|r_shadow_shadowmapping_nearclip|Shadowmap near clip in world units. Increasing this will make shadow rendering to be more precise (as more bits goes to middle range), at the cost of the small non-shadowed zone around light}}
{{cvar|r_shadow_shadowmapping_polygonfactor|Slope-dependent shadow mapping bias}}
+
{{cvar|r_shadow_shadowmapping_polygonfactor|Slope-dependent shadowmapping bias}}
{{cvar|r_shadow_shadowmapping_polygonoffset|Constant shadow mapping bias}}
+
{{cvar|r_shadow_shadowmapping_polygonoffset|Constant shadowmapping bias}}
 
{{cvar|r_shadow_shadowmapping_precision|Makes shadowmaps have a maximum resolution of this number of pixels per light source radius unit such that, for example, at precision 0.5 a light with radius 200 will have a maximum resolution of 100 pixels}}
 
{{cvar|r_shadow_shadowmapping_precision|Makes shadowmaps have a maximum resolution of this number of pixels per light source radius unit such that, for example, at precision 0.5 a light with radius 200 will have a maximum resolution of 100 pixels}}
 
{{cvar|r_shadow_shadowmapping_useshadowsampler|whether to use sampler2DShadow if available}}
 
{{cvar|r_shadow_shadowmapping_useshadowsampler|whether to use sampler2DShadow if available}}

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)

This page is a member of 2 hidden categories:

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox