Light probes

From Divinity Engine Wiki
Jump to: navigation, search


General

Light probes are the Larian Engine's system for indirect lighting and reflections. A pre-calculated approximation to global illumination.
In short, a light probe is an object you place in the level. It looks at the surrounding lighting and objects and uses that information to calculate realistic indirect lighting.
This includes light bouncing off of objects, causing colors to carry over to nearby objects (this effect is called color bleeding).
It also provides accurate reflections of surrounding objects.


Probe Types

There are 2 types of light probes, used for different parts of the overall lighting: distant and local light probes.


Distant

Distant probes are used to account for far away lighting information: the sun and sky.
It uses the information of the surrounding atmosphere to apply an approximation of sun and sky light bouncing and color bleeding to everything in that atmosphere.
Since the probe contains atmosphere information, it applies to everything in that atmosphere. So in editor terms, you only need one distant probe per atmosphere trigger.

For more information on atmospheres, look here: Atmosphere panel
More information on atmosphere triggers can be found here: Triggers


Local

Local probes are used to simulate color bleeding and reflections related to nearby lights and objects.
Local probes only gather information within a defined area around them and thus, only apply to objects in that same area.
Contrary to distant probes, you can place as many local probes as you want. Even probes inside other probe areas are allowed.
The lighting of the smallest probes always gets priority over the lighting of a larger probe that covers the same area. With local probes, you fine-tune illumination and reflections where the distant probe, or a larger local probe proves to be insufficient.


Shapes

Probe influence areas are approximated by 2 shape types: spheres and boxes.
This only applies to local probes. Distant probes capture all information visible, without being limited within a specific area.


Lighting Types

Probes can capture two types of lighting.
Diffuse light is of a very low resolution and captures the general color of the surroundings.
The performance cost of this light type is very low and produces what we know as 'bounce light'.
Specular lighting is of a high resolution and is used to produce reflections on smooth surfaces and metals.
This lighting is far more expensive. It is also most notable on smooth surfaces and metals.
These materials accurately reflect their surrounding, thus an accurate reflection is necessary. In other situations, a more general capture might suffice.

Given how dynamic a world can be (characters with metal armors running around), generally you'll want to have both diffuse and specular capture enabled on a probe.
But because mirror-like surfaces are very rare (metal armor is not a mirror), for performance it is beneficial to use less specular probes.
Don't worry too much though. Performance impact will only be noticeable when having multiple tens of probes visible on screen at the same time.

Rule of thumb

Capture both.
If you start having a multitude of probes in one screen, look to reducing performance impact by generalizing the specular probe.

Sidenote

Don't tweak too much. There might be intensity scaling on probes, but working with several probes and/or splitting diffuse and specular probes can have unwanted side effects.
Start with an intensity of 1, and slowly adjust situations. Again from big to small.


Atmospheres

Atmospheres (sun direction, sky color) naturally influence the lighting and probes account for this.
Atmospheres are defined by atmosphere triggers.


As mentioned earlier, always place one distant probe per atmosphere trigger.
Local probes will gather lighting information from the atmosphere trigger they are in.


To account for atmosphere changes (day to night), which can be achieved through scripting, atmosphere triggers can be assigned multiple atmospheres (through atmosphere resources).
Probes will gather information from every atmosphere assigned to the atmosphere trigger they are in.

Information on atmosphere resources can be found here: Resources
For more information on atmosphere triggers, look here: Triggers


Best Practice

Light probes make a scene's lighting feel more natural.
To optimally make use of light probes, try to follow these guidelines:

  • Always 1 distant probe per atmosphere. Always place one distant probe to capture far off lighting and apply it to everything in that atmosphere. This is your base layer of natural lighting.
  • Place distant probes low to the ground. This way, they are more heavily influences by the ground color, making color bleeding more apparent.
  • Follow geometry when placing local probes. Try to align the probe's influence area as closely as possible to its surrounding. F.e. shape a probe like the room the probe is in.
  • Start big. Too many probes can be bad for performance. Start with the distant probe and large/rough local probes. Only place a smaller probe where necessary.