Dynamic Occlusion (Depth Buffer) Component
The Dynamic Occlusion features (Raycasting and Depth Buffer) give awareness to your light beams: they react to the changes in the environment. Light Beams can be blocked and occluded by 3D or 2D geometry.
|Dynamic Occlusion OFF||Dynamic Occlusion ON|
Without this feature, Volumetric Light Beams are not blocked by geometry: think about it like a Light with disabled shadows. This means that if you place a light beam against a wall, the light beam could shine through it and be visible from the other side.
Which Dynamic Occlusion should I use?
The plugin supports 2 different implementations of dynamic occlusion. You might be interested in using one or the other (or both) depending on your needs.
In short, Dynamic Occlusion using the Depth Buffer provides a more precise occlusion system, while using Raycasting offers better performance and supports 2D (a 2D sprite can be an occluder).
(it can be only fully blocked or not blocked)
(computed using only a single virtual plane)
(occluders smaller than beam's radius won't be caught but depth buffer)
|Require a Collider component on each occluder||Yes||No|
Dynamic Occlusion in Editor & Playmode
To maximize performance, when you are playing your game in the Editor, the Dynamic Occlusion will only be updated if at least one game camera looks at your beam.
This means you might see wrong occlusion effect applied on a beam in the Editor's Scene View if no game camera looks at it.
This feature creates a virtual camera per beam to capture the depth buffer from the beam's point of view. It uses this depth texture to compute a very precise occlusion capable of handling partial and complex occlusions.
The Dynamic Occlusion (Depth Buffer) component must be attached to a Volumetric Light Beam. You can use this button at the bottom of the Volumetric Light Beam inspector.
The beam can only be occluded by objects located on the layers matching this mask.
- It's very important to set it as restrictive as possible (checking only the layers which are necessary) to perform a more efficient process in order to increase the performance.
- You have to set an Override Layer in the Config when using this feature, and make sure the Layer Mask does NOT include this Override Layer to prevent from having a Layer Mask including any Volumetric Beam.
Whether or not the virtual camera will use occlusion culling during rendering from the beam's POV.
Depth Map Resolution
Controls how large the depth texture captured by the virtual camera is.
The lower the resolution, the better the performance, but the less accurate the rendering.
Fade Distance Units
Fade out the beam before the occlusion surface in order to soften the transition.
How often will the occlusion be processed?
Try to update the occlusion as rarely as possible to keep good performance.
- Never: The occlusion will never be updated.
The only way to update it is to manually call 'DynamicOcclusionXXX.ProcessOcclusionManually()' from script whenever you need.
- OnEnable: The occlusion will only be updated once on start, and each time the beam is enabled/activated (after being disabled/deactivated).
It's suitable for static beams located in static environment.
- OnBeamMove: The occlusion will only be updated when the beam will move.
It's suitable for moving beams located in static environment.
- EveryXFrames: The occlusion will be updated every X frame(s).
It's suitable for static beams located in moving environment.
- OnBeamMoveAndEveryXFrames: The occlusion will be updated when the beam will move in addition to every X frame(s).
It's suitable for moving beams located in moving environment.
X frames to wait
How many frames we wait between 2 occlusion tests?
- If you want your beam to be super responsive to the changes of your environment, update it every frame by setting 1.
- If you want to save on performance, we recommend to wait few frames between each update by setting a higher value. For example with the value 3, the system will perform 1 occlusion test every 3 frames.