{"record":{"id":"62313fdfdf3da9c0","repo":"stride3d/stride","slug":"missing-mesh-render-feature","errorCode":null,"errorMessage":"Missing mesh render feature","messagePattern":"Missing mesh render feature","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/LightShafts/LightShafts.cs","lineNumber":92,"sourceCode":"        {\n            base.InitializeCore();\n\n            // Light accumulation shader\n            lightShaftsEffectShader = ToLoadAndUnload(new ImageEffectShader(\"LightShaftsEffect\"));\n\n            // Additive blending shader\n            applyLightEffectShader = ToLoadAndUnload(new ImageEffectShader(\"AdditiveLightEffect\"));\n            applyLightEffectShader.BlendState = new BlendStateDescription(Blend.One, Blend.One);\n\n            minmaxVolumeEffectShader = new DynamicEffectInstance(\"VolumeMinMaxShader\");\n            minmaxVolumeEffectShader.Initialize(Context.Services);\n\n            blur = ToLoadAndUnload(new GaussianBlur());\n\n            // Need the shadow map renderer in order to render light shafts\n            var meshRenderFeature = Context.RenderSystem.RenderFeatures.OfType<MeshRenderFeature>().FirstOrDefault();\n            if (meshRenderFeature == null)\n                throw new InvalidOperationException(\"Missing mesh render feature\");\n\n            var forwardLightingFeature = meshRenderFeature.RenderFeatures.OfType<ForwardLightingRenderFeature>().FirstOrDefault();\n            if (forwardLightingFeature == null)\n                throw new InvalidOperationException(\"Missing forward lighting render feature\");\n\n            shadowMapRenderer = forwardLightingFeature.ShadowMapRenderer;\n\n            for (int i = 0; i < 2; ++i)\n            {\n                var minmaxPipelineState = new MutablePipelineState(Context.GraphicsDevice);\n                minmaxPipelineState.State.SetDefaults();\n\n                minmaxPipelineState.State.BlendState.RenderTargets[0].BlendEnable = true;\n                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorSourceBlend = Blend.One;\n                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorDestinationBlend = Blend.One;\n                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorBlendFunction = i == 0 ? BlendFunction.Min : BlendFunction.Max;\n                minmaxPipelineState.State.BlendState.RenderTargets[0].ColorWriteChannels = i == 0 ? ColorWriteChannels.Red : ColorWriteChannels.Green;\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/LightShafts/LightShafts.cs#L74-L110","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add a MeshRenderFeature to your RenderSystem (in the graphics compositor/renderer configuration) before using LightShafts.","In code: renderSystem.RenderFeatures.Add(new MeshRenderFeature()) plus its required passes before the LightShafts renderer initializes.","If you don't need light shafts, remove the LightShafts renderer from the compositor."],"exampleFix":"// before\nvar compositor = new GraphicsCompositor();\ncompositor.RenderSystem.RenderFeatures.Add(new ForwardLightingRenderFeature()); // MeshRenderFeature missing\n// after\ncompositor.RenderSystem.RenderFeatures.Add(new MeshRenderFeature());\ncompositor.RenderSystem.RenderFeatures.Add(new ForwardLightingRenderFeature());","handlingStrategy":"validation","validationCode":"var hasMeshFeature = Context.RenderSystem.RenderFeatures.OfType<MeshRenderFeature>().Any();\nif (!hasMeshFeature)\n    Context.RenderSystem.RenderFeatures.Add(new MeshRenderFeature()); // before enabling LightShafts","typeGuard":null,"tryCatchPattern":"try { scene.Compositor.RenderSystem.Initialize(); }\ncatch (InvalidOperationException e) { Log.Fatal($\"Render pipeline misconfigured: {e.Message}\"); throw; }","preventionTips":["Start custom compositors from the default template which already includes MeshRenderFeature.","Before adding LightShafts, assert MeshRenderFeature exists in the RenderSystem.","Avoid removing 'unused' render features from shared compositor configurations."],"tags":["missing-dependency","render-feature","light-shafts","stride"],"backgroundTag":"missing-dependency","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}