Lightgrid

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
 
(15 intermediate revisions by one user not shown)
Line 1: Line 1:
Lightgrid or volumeric lighting - a data structure used to store static lighting for models. Lightgrid are created during LIGHT phase each time map is compiled.
+
{{need screenshot}}
 +
{{grammar}}
 +
A three-dimensional data structure used to store static lighting on models. Lightgrid are created during [[LIGHT phase]] each time map is compiled.
  
=== How it works ===
+
====How it works====
  
 
Each cell of lightgrid stores this information:
 
Each cell of lightgrid stores this information:
* Ambient light RGB
+
* Ambient RGB
* Diffuse light RGB
+
* Average light vector (used for diffuse lighting)
* Light vector
+
* Diffuse RGB
  
When rendered, entity sample it's position at lightgrid and find average ambient and diffuse lighting to be applied during shading.
+
When rendered, entity sample it's position at lightgrid and get average ambient and diffuse components to be applied during shading. Any entity that doesnt use lightmaps and not fullbright, is, by default, lit with lightgrid.
  
=== Level Design Notes ===
+
====Resolution====
 +
Lightgrid resolution on a particular map comes from it's bounds and cell size.
  
* Default lightgrid cell size in game units is '64 64 128'. It can be customized with "gridsize" worldspawn key. Most of Blood Omnicide maps using lightgrid size '32 32 32' or '32 32 64'.
+
Default lightgrid cell size in game units is '64 64 128'. It can be customized with "gridsize" [[worldspawn]] key. Most of Blood Omnicide maps using lightgrid size '32 32 32' or '32 32 64'.  
  
* Often map bounds is much bigger than the space players and NPC can walk on. To not waste memory and reduce map compile time, level designer should place a brush covered by [[Common materials | common/lightgrid]] material. That brush will set the area where lightgrid will be calculated and applied.
+
{{important|Do not use too small cell size because amount on memory and time it takes to calculate grows geometrically.}}
  
* Sometimes lightgrid is more bright or darker that the rest of environments, this makes entities to look out of the place. In order to make lightgrid match environments corrections should be made in a [[map build script]]. There is 2 coefficients to fix lightgrid: diffuse scale (scales intensity of diffise lightgrid component) and ambient scale (scales ambient RGB component).
+
Often map bounds is much bigger than the space players and NPC can walk in. To not waste memory and reduce map compile time, level designer should place a brush covered by [[Common materials | common/lightgrid]] material. That brush will set the area where lightgrid will be calculated and applied.
  
== See also ==
+
====Corrections====
 +
Sometimes lightgrid is lighter or darker that the rest of environments which makes entities to look out of the place.
 +
 
 +
In order to make lightgrid match environments, a corrections should be made in a [[map build script]]. There is two coefficients to mess with:
 +
* diffuse scale: scales intensity of diffise lightgrid component
 +
* ambient scale: scales ambient RGB component
 +
 
 +
==Console variables==
 +
{{cvar|r_ambient|adds intensity to lightmap and lightgrid. Positive values makes map brighter (note: manual edit of this cvar via console does not work in Blood Omnicide, as cvar is controlled by gamecode).}}
 +
{{cvar|r_fullbright|disables static lighting.}}
 +
 
 +
==See also==
 +
* [[Darkplaces lighting]]
 
* [[Lightmap]]
 
* [[Lightmap]]
 +
* [[Vertex lighting]]
  
 
[[Category:Glossary]]
 
[[Category:Glossary]]
 +
[[Category:Darkplaces engine]]
 +
[[Category:Lighting]]
 +
{{finished}}
 +
__NOTOC__

Latest revision as of 23:41, 30 July 2012

This page requires a screenshot or video of the subject
Want to make one?

A three-dimensional data structure used to store static lighting on models. Lightgrid are created during LIGHT phase each time map is compiled.

[edit] How it works

Each cell of lightgrid stores this information:

  • Ambient RGB
  • Average light vector (used for diffuse lighting)
  • Diffuse RGB

When rendered, entity sample it's position at lightgrid and get average ambient and diffuse components to be applied during shading. Any entity that doesnt use lightmaps and not fullbright, is, by default, lit with lightgrid.

[edit] Resolution

Lightgrid resolution on a particular map comes from it's bounds and cell size.

Default lightgrid cell size in game units is '64 64 128'. It can be customized with "gridsize" worldspawn key. Most of Blood Omnicide maps using lightgrid size '32 32 32' or '32 32 64'.

Important: Do not use too small cell size because amount on memory and time it takes to calculate grows geometrically.

Often map bounds is much bigger than the space players and NPC can walk in. To not waste memory and reduce map compile time, level designer should place a brush covered by common/lightgrid material. That brush will set the area where lightgrid will be calculated and applied.

[edit] Corrections

Sometimes lightgrid is lighter or darker that the rest of environments which makes entities to look out of the place.

In order to make lightgrid match environments, a corrections should be made in a map build script. There is two coefficients to mess with:

  • diffuse scale: scales intensity of diffise lightgrid component
  • ambient scale: scales ambient RGB component

[edit] Console variables

 r_ambient : adds intensity to lightmap and lightgrid. Positive values makes map brighter (note: manual edit of this cvar via console does not work in Blood Omnicide, as cvar is controlled by gamecode).
 r_fullbright : disables static lighting.

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox