stride3d/stride · error · InvalidOperationException

Missing mesh render feature

Error message

Missing mesh render feature

What it means

LightShafts requires a MeshRenderFeature registered in the RenderSystem to obtain the shadow map pipeline it renders light shafts with. InitializeCore searches Context.RenderSystem.RenderFeatures for a MeshRenderFeature and throws InvalidOperationException if none is present. This indicates the render pipeline was configured without mesh rendering, which light shafts cannot work without.

Solutions

  1. Add a MeshRenderFeature to your RenderSystem (in the graphics compositor/renderer configuration) before using LightShafts.
  2. In code: renderSystem.RenderFeatures.Add(new MeshRenderFeature()) plus its required passes before the LightShafts renderer initializes.
  3. If you don't need light shafts, remove the LightShafts renderer from the compositor.

Example fix

// before
var compositor = new GraphicsCompositor();
compositor.RenderSystem.RenderFeatures.Add(new ForwardLightingRenderFeature()); // MeshRenderFeature missing
// after
compositor.RenderSystem.RenderFeatures.Add(new MeshRenderFeature());
compositor.RenderSystem.RenderFeatures.Add(new ForwardLightingRenderFeature());
Defensive patterns

Strategy: validation

Validate before calling

var hasMeshFeature = Context.RenderSystem.RenderFeatures.OfType<MeshRenderFeature>().Any();
if (!hasMeshFeature)
    Context.RenderSystem.RenderFeatures.Add(new MeshRenderFeature()); // before enabling LightShafts

Try / catch

try { scene.Compositor.RenderSystem.Initialize(); }
catch (InvalidOperationException e) { Log.Fatal($"Render pipeline misconfigured: {e.Message}"); throw; }

Prevention

When it happens

Trigger: Adding a LightShafts renderer to a custom graphics compositor whose RenderSystem has no MeshRenderFeature registered (e.g. a bare/custom renderer pipeline that only does post effects).

Common situations: Building a custom compositor from scratch and forgetting the mesh render feature; stripped-down headless/2D-only pipelines; removing default render features during engine customization.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/Images/LightShafts/LightShafts.cs:92

        {
            base.InitializeCore();

            // Light accumulation shader
            lightShaftsEffectShader = ToLoadAndUnload(new ImageEffectShader("LightShaftsEffect"));

            // Additive blending shader
            applyLightEffectShader = ToLoadAndUnload(new ImageEffectShader("AdditiveLightEffect"));
            applyLightEffectShader.BlendState = new BlendStateDescription(Blend.One, Blend.One);

            minmaxVolumeEffectShader = new DynamicEffectInstance("VolumeMinMaxShader");
            minmaxVolumeEffectShader.Initialize(Context.Services);

            blur = ToLoadAndUnload(new GaussianBlur());

            // Need the shadow map renderer in order to render light shafts
            var meshRenderFeature = Context.RenderSystem.RenderFeatures.OfType<MeshRenderFeature>().FirstOrDefault();
            if (meshRenderFeature == null)
                throw new InvalidOperationException("Missing mesh render feature");

            var forwardLightingFeature = meshRenderFeature.RenderFeatures.OfType<ForwardLightingRenderFeature>().FirstOrDefault();
            if (forwardLightingFeature == null)
                throw new InvalidOperationException("Missing forward lighting render feature");

            shadowMapRenderer = forwardLightingFeature.ShadowMapRenderer;

            for (int i = 0; i < 2; ++i)
            {
                var minmaxPipelineState = new MutablePipelineState(Context.GraphicsDevice);
                minmaxPipelineState.State.SetDefaults();

                minmaxPipelineState.State.BlendState.RenderTargets[0].BlendEnable = true;
                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorSourceBlend = Blend.One;
                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorDestinationBlend = Blend.One;
                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorBlendFunction = i == 0 ? BlendFunction.Min : BlendFunction.Max;
                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorWriteChannels = i == 0 ? ColorWriteChannels.Red : ColorWriteChannels.Green;

View on GitHub (pinned to 96fad776d2)