Skip to content

Optimization guidelines

Drawcall Batching

Batching is a optimization technique to combine several drawcalls together to reduce the amount of work sent to the GPU. The Volumetric Light Beam plugin offers 2 different techniques (GPU Instancing and SRP Batcher) in order to batch the geometry used by different volumetric light beams.
This allows to render unlimited beams using 1 single drawcall under great performance.

Drawcall batching with GPU Instancing enabled

This documentation will explain you how to take advantage of this optimization, its limitations and the possible workarounds.


Types of Batching

GPU Instancing

GPU Instancing is available on almost all platforms (except HDRP), but is not a magic solution to increase performance: it will highly depend on the platform.
Using GPU Instancing is particularly recommended when running on high-end platforms such as PC and Mac: it's perfect to save performance with high-end VR for example.
Otherwise on mobile, the performance can actually get worse, so it's recommended to keep using Multi-Pass or Single-Pass rendering mode on Android and iOS.

To support GPU Instancing, you have to switch the Rendering Mode to GPU Instancing in the configuration file.

Rendering Mode GPU Instancing

SRP Batcher

SRP Batcher is only available with SRP (URP or HDRP).
SRP Batcher improves the performance on all tested platforms, so we recommend to use this rendering mode when you can.

To support SRP Batcher, you have to switch the Rendering Mode to SRP Batcher in the configuration file.

Rendering Mode SRP Batcher

Obviously the SRP Batcher option should also be enabled in your URP/HDRP asset.

SRP Batcher enabled

SRP Batcher option not visible?

If this option is not visible, follow the instructions below (detailled in Unity's documentation):

  • In the URP Asset, in any section, click the vertical ellipsis icon (⋮) and select Show Additional Properties. SRP Batcher: Show Additional Properties
  • You should now have the option visible.

Performance Overview

Here is a matrix showing the results of internal benchmarks made on various devices, that could help you choose which mode to choose depending on your needs.

Platform Render Pipeline Single Pass GPU Instancing SRP Batcher
PC/Mac/Linux Built-in ++ +++ not available
PC/Mac/Linux URP ++ +++ +++
PC/Mac/Linux HDRP ++ not available +++
Mobile Built-in ++ + not available
Mobile URP ++ + +++

Limitation

What can be batched?

When using either GPU Instancing or SRP Batcher Rendering Mode, multiple beams will be batched together only under specific conditions, if they all use:

Real-time Lighting

Be careful if you are using real-time lights in your scene: 2 beams overlapped by different real-time lights can't be batched together. This is the case if you use real-time Unity's spotlights and Volumetric Light Beams attached together.

Realtime Light Inspector

It will generate an additive forward drawcall per beam, breaking the batching, even if using Deferred Rendering Path. Unfortunately, this is a limitation Unity carries for years, so nothing can be done on our side.

Realtime Light Frame Debugger

Fortunately, there is a pretty easy workaround: using the Culling Mask property, you can simply cull off from your dynamic lights the layer on which your Volumetric Light Beams are created.

  • Create a specific Layer for your light beams.
    Cull off beams from realtime lights

  • In the configuration file, select this Layer as the Override Layer property.
    Cull off beams from realtime lights

  • Cull off this Layer on each one of your real-time light.
    Cull off beams from realtime lights

Using this simple workaround, you can enjoy GPU Instancing optimization while still having real-time lights.


Debugging

When you select multiple VolumetricLightBeam instances in the editor, the info panel located in the inspector will tell you if they could be batched together, or why they cannot. Use this feature to debug batching issues. Note that this debugging info doesn't take account of the real-time lights limitation.

Debug Batching


Level of Detail (LOD)

The plugin offers some compatibility with the built-in LOD system via the LOD Beam Group component.
It allows you to dynamically switch from a highly detailed HD Beam with shadows enabled, to more performant beams depending on the visual size of your beam on screen.
Using this technique can significally improve your performance.


VR

Single Pass Stereo Rendering

The plugin is compatible with Single Pass and Single Pass Instanced Stereo Rendering Methods. This is an optimization technique which heavily decreases CPU use in VR by rendering both left and right eye images at the same time.

Enabling Single Pass Stereo Rendering Enabling Single Pass Stereo Rendering

There is unfortunately a limitation due to a bug in Unity when running on mobile VR (Gear VR, Oculus Go, Oculus/Meta Quest...): read more about this limitation and the possible workarounds in the Troubleshooting page.