Select Page
View Categories

How light probes work in Unity3D

6 min read

In Unity3D, light probes are utilised to provide dynamic lighting and reflections for objects within a scene. Light probes function by capturing the lighting and shading information from a scene, and then creating a set of sample points, which are subsequently used to calculate the lighting and reflections for objects in the scene.

What is a light probe group? #

A Light Probe Group is an assembly of small spheres that are employed to sample the lighting in the scene. These spheres are strategically placed throughout the scene, with their positions determined by the user or automatically generated by Unity3D. Each of these spheres represents a point in space where the lighting is sampled.

Unity3D’s Light Probe Group is a feature that enables you to accurately render lighting on objects in your scene, even when they are situated in areas with complex lighting conditions, such as inside a building or beneath a bridge. Light Probe Groups contribute to providing global illumination for dynamic objects in real-time rendering.

Upon loading a scene, Unity3D places several light probes throughout the scene. Each probe is positioned to capture the lighting information for a specific area of the scene. The probes are essentially small volumes that capture lighting and shading information at a set of sample points within their boundaries.

When an object is placed in the scene, its lighting and shading information is calculated using the nearest light probes. The probes are employed to interpolate the lighting information between them, which delivers an accurate approximation of the lighting conditions for the object. This interpolation is achieved by calculating a weighted average of the lighting information from the probes, based on the distance of the object to each probe.

Light probes are particularly valuable for dynamic objects, which may move and change position within the scene. The probes enable real-time lighting and shading updates to be applied to these objects as they move, which assists in maintaining the realism and consistency of the lighting in the scene.

In addition to providing dynamic lighting and reflections, light probes can also be employed to enhance the performance of the rendering engine. By capturing and storing lighting information in the probes, Unity3D can circumvent the need for resource-intensive real-time calculations of lighting and reflections, which can be particularly demanding on hardware resources.

When an object is rendered, the Light Probe Group samples the lighting in the surrounding area and applies it to the object. This ensures that the object is accurately lit, even if it is positioned in an area with complex lighting.

Light Probe Groups can be created and modified using Unity3D’s built-in tools. You can adjust the number of probes in the group, their size, and their position in the scene. Additionally, you can utilise Unity3D’s baking tools to precompute the lighting for the Light Probe Group, which can enhance performance in real-time rendering.

Light Probe Groups are an essential tool for achieving realistic lighting in your Unity3D scenes, and they are an excellent way to provide accurate global illumination for dynamic objects.

How does Light Probe Groups improve performance? #

Light Probe Groups can speed up baking time and enhance performance in real-time rendering in several ways:

  1. Reduced need for real-time calculations: By capturing and storing lighting information within the Light Probe Group, Unity3D can avoid performing expensive real-time calculations of lighting and reflections. This reduction in real-time calculations can save on processing power and resources, ultimately leading to better performance during real-time rendering.
  2. Precomputed lighting data: Unity3D’s baking tools allow you to precompute the lighting information for the Light Probe Group. During the baking process, the global illumination, reflections, and other lighting data are calculated and stored within the light probes. When the scene is rendered in real-time, this precomputed information is used to light objects, reducing the need for additional real-time lighting calculations.
  3. Efficient distribution of lighting data: Light Probe Groups provide an efficient way to distribute lighting information across a scene. By strategically placing light probes throughout a scene, Unity3D can interpolate the lighting information between them, providing an accurate approximation of the lighting conditions for objects. This efficient distribution of lighting data minimises the need for additional real-time lighting sources, reducing overall baking time and improving performance.
  4. Adaptive usage: Light Probe Groups can adapt to the needs of a particular scene or application. You can configure the number of light probes, their size, and their placement in the scene, which allows you to balance the level of detail in the lighting with the performance requirements of your project. By optimising the configuration of the Light Probe Group, you can achieve faster baking times and improved real-time rendering performance.

Light Probe Groups enhance real-time rendering performance by capturing and storing lighting information, reducing the need for real-time calculations, and efficiently distributing lighting data across a scene. This combination of factors leads to faster baking times and improved performance during real-time rendering.

Tips for Beginners Using Light Probe Groups #

When starting out with Light Probe Groups in Unity3D, it’s essential to understand how to use them effectively without overcrowding your scene or negatively impacting performance. Here are some tips for beginners on using Light Probe Groups and determining the right number of probes for a room or scene:

1. Understand the purpose of light probes #

Before diving into Light Probe Groups, ensure you understand their purpose and how they contribute to a scene. Light probes capture lighting and shading information, providing accurate lighting for dynamic objects in areas with complex lighting conditions. They are particularly useful for improving the visual quality of your scene and optimising performance.

2. Start with a simple scene #

When you’re learning to use Light Probe Groups, it’s helpful to start with a simple scene. This allows you to focus on understanding how light probes work, their placement, and their impact on lighting and performance without getting overwhelmed by complex geometry or intricate lighting conditions.

3. Calculate the number of probes needed #

To determine the number of probes required in a room or scene, consider the following factors:

  • Size of the room or scene: Larger scenes typically require more probes to capture the lighting information accurately. However, it’s important not to overdo it, as too many probes can negatively impact performance.
  • Complexity of lighting: Scenes with complex lighting conditions, such as multiple light sources or varying levels of brightness, may require more probes to ensure accurate lighting for dynamic objects.
  • Object movement: If your scene contains dynamic objects that move frequently, you may need more probes to accommodate their changing positions and maintain accurate lighting.

As a general rule, start with a modest number of probes and gradually increase them while monitoring the impact on performance and visual quality. Striking a balance between sufficient lighting information and performance is key.

4. Optimal placement of probes #

Place light probes in areas where dynamic objects are expected to interact or move through. Ensure that probes are distributed evenly throughout the scene to provide a smooth transition of lighting information between them. Avoid placing probes too close together or too far apart, as this can lead to poor interpolation and inaccurate lighting.

5. Test and iterate #

Experiment with different configurations of Light Probe Groups, and test their impact on your scene’s lighting and performance. By testing and iterating, you’ll develop a better understanding of how many probes you need in a room or scene without overcrowding it or affecting performance negatively.

How many light probes are too many? #

Determining the exact number of light probes to use per metre can be challenging, as it depends on various factors like the complexity of lighting, object movement, and desired performance. However, for a simple cube room measuring 5 x 5 x 5 units with a single light source in the centre, you can follow this guideline to get started:

  1. Place one light probe near each of the eight corners of the cube room (top and bottom corners of the cube room).
  2. Add one light probe in the centre of each wall (six in total).
  3. Lastly, place a light probe directly below and above the central light source.

This configuration would result in a total of 16 light probes for the given 5 x 5 x 5 cube room. This arrangement should provide a good starting point for accurate lighting on dynamic objects while maintaining optimal performance.

However, it is essential to test and iterate on this setup, as the ideal number of light probes may vary depending on specific scene requirements or object interactions within the room. You can adjust the number of probes and their placement to achieve the best balance between lighting quality and performance for your specific use case.

Powered by BetterDocs