Build Optimizations
intermediate performanceVolumetric Lights 2 (Built-in) · Troubleshooting & FAQ
Build Optimizations
Volumetric Lights uses shader keywords to conditionally enable features. Each keyword multiplies the number of shader variants, which can increase initial build time. Once built, Unity caches the compiled shaders so subsequent builds are much faster.
Reducing Shader Variants
If you want to speed up builds or reduce the final build size, you can remove keywords for features you are not using.
- Locate
VolumetricLight.shaderinVolumetricLights/Resources/Shaders. - Comment out or remove any of the following lines for features you do not use:
Optional Feature Keywords
| Keyword | Feature |
|---|---|
VF2_DEPTH_PREPASS | Depth prepass support |
VL_NOISE | Noise option |
VL_BLUENOISE | Blue noise option |
VL_DIFFUSION | Diffusion Intensity |
VL_PHYSICAL_ATTEN | Quadratic attenuation |
VL_CUSTOM_BOUNDS | Custom Bounds option |
Light Type Keywords
Remove keywords for light types you do not use in your project:
| Keyword | Light Type |
|---|---|
VL_SPOT | Spot light |
VL_SPOT_COOKIE | Spot light with cookie texture |
VL_POINT | Point light |
VL_AREA_RECT | Rectangular area light |
VL_AREA_DISC | Disc area light |
Shadow Keywords
If you do not use shadows at all, remove the entire shadow keyword line. If you use shadows but not cubemap-based shadows (point lights only), remove just the VL_SHADOWS_CUBEMAP keyword:
// Remove this entire line if no shadows are used:
#pragma multi_compile_local _ VL_SHADOWS VL_SHADOWS_CUBEMAP
// Or keep only standard shadows:
#pragma multi_compile_local _ VL_SHADOWS
VolumetricLight.shader will be overwritten. Remember to re-apply your keyword removals after upgrading.
Suggest an improvement
Help us improve this documentation page.