stride3d/stride · error · ArgumentNullException

No Voxel Volume Component selected for voxel light.

Error message

No Voxel Volume Component selected for voxel light.

What it means

LightVoxelRenderer's GetProcessedVolume throws ArgumentNullException when a voxel light's LightVoxel type has Volume == null, i.e. no Voxel Volume component was assigned to the light. A voxel light can only be traced through a voxel volume, so without one the renderer cannot proceed. Notably it uses ArgumentNullException for what is semantically a missing component reference.

Solutions

  1. Assign a Voxel Volume component to the light's Volume property in the editor or code.
  2. Before rendering, check lightVoxel.Volume for null and skip or disable the light.
  3. Fix broken scene references so lights point at existing voxel volume entities.

Example fix

// before
var light = new LightComponent { Type = new LightVoxel() }; // Volume not set
// after
var light = new LightComponent { Type = new LightVoxel { Volume = myVoxelVolumeComponent } };
Defensive patterns

Strategy: type-guard

Validate before calling

if (light.Type is LightVoxel lv && lv.Volume == null)
{
    // skip or disable this light
    return null;
}

Type guard

bool HasVoxelVolume(LightComponent light) => light.Type is LightVoxel lv && lv.Volume != null;

Try / catch

try { var vol = GetProcessedVolume(); }
catch (ArgumentNullException) { /* no volume assigned; disable light */ }

Prevention

When it happens

Trigger: Adding/using a LightVoxel light whose Volume property was never assigned (or was cleared), then rendering a frame where processedVolume is queried.

Common situations: Creating a voxel light in code without setting light.Type.Volume; a scene edit/prefab update clearing the volume reference; deleting a voxel volume entity that lights still pointed to.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/ef75b8300c9944e3. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Voxels/Voxels/Light/LightVoxelRenderer.cs:106

            private PermutationParameterKey<ShaderSource> specularMarcherKey;
            private PermutationParameterKey<ShaderSourceCollection> attributeSamplersKey;

            public RenderLight Light { get; set; }

            VoxelAttribute traceAttribute = null;

            public LightVoxelShaderGroup(ShaderSource mixin) : base(mixin)
            {
                HasEffectPermutations = true;
                traceAttribute = null;
            }

            ProcessedVoxelVolume GetProcessedVolume()
            {
                var lightVoxel = ((LightVoxel)Light.Type);
                if (lightVoxel.Volume == null)
                {
                    throw new ArgumentNullException("No Voxel Volume Component selected for voxel light.");
                }
                var voxelVolumeProcessor = lightVoxel.Volume.Entity.EntityManager.GetProcessor<VoxelVolumeProcessor>();
                if (voxelVolumeProcessor == null)
                    return null;

                ProcessedVoxelVolume processedVolume = voxelVolumeProcessor.GetProcessedVolumeForComponent(lightVoxel.Volume);
                return processedVolume;
            }

            VoxelAttribute GetTraceAttr()
            {
                var lightVoxel = ((LightVoxel)Light.Type);

                ProcessedVoxelVolume processedVolume = GetProcessedVolume();
                if (processedVolume == null)
                    return null;

                if (processedVolume.OutputAttributes.Count > lightVoxel.AttributeIndex)

View on GitHub (pinned to 96fad776d2)