Build Optimizations

intermediate performance

Volumetric 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.

  1. Locate VolumetricLight.shader in VolumetricLights/Resources/Shaders.
  2. Comment out or remove any of the following lines for features you do not use:

Optional Feature Keywords

KeywordFeature
VF2_DEPTH_PREPASSDepth prepass support
VL_NOISENoise option
VL_BLUENOISEBlue noise option
VL_DIFFUSIONDiffusion Intensity
VL_PHYSICAL_ATTENQuadratic attenuation
VL_CUSTOM_BOUNDSCustom Bounds option

Light Type Keywords

Remove keywords for light types you do not use in your project:

KeywordLight Type
VL_SPOTSpot light
VL_SPOT_COOKIESpot light with cookie texture
VL_POINTPoint light
VL_AREA_RECTRectangular area light
VL_AREA_DISCDisc 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
Important: If you upgrade Volumetric Lights to a newer version, changes to VolumetricLight.shader will be overwritten. Remember to re-apply your keyword removals after upgrading.
Was this page helpful?