{"record":{"id":"f80838d52b028cfd","repo":"bevyengine/bevy","slug":"failed-to-prepare-atmosphere-bind-groups-light-un","errorCode":null,"errorMessage":"Failed to prepare atmosphere bind groups. Light uniform buffer missing","messagePattern":"Failed to prepare atmosphere bind groups\\. Light uniform buffer missing","errorType":"exception","errorClass":"AtmosphereBindGroupError","httpStatus":null,"severity":"error","filePath":"crates/bevy_pbr/src/atmosphere/resources.rs","lineNumber":617,"sourceCode":"    pub multiscattering_lut: BindGroup,\n    pub sky_view_lut: BindGroup,\n    pub aerial_view_lut: BindGroup,\n    pub render_sky: BindGroup,\n}\n\n#[derive(Copy, Clone, Debug, thiserror::Error)]\nenum AtmosphereBindGroupError {\n    #[error(\"Failed to prepare atmosphere bind groups. Atmosphere uniform buffer missing\")]\n    Atmosphere,\n    #[error(\n        \"Failed to prepare atmosphere bind groups. AtmosphereTransforms uniform buffer missing\"\n    )]\n    Transforms,\n    #[error(\"Failed to prepare atmosphere bind groups. AtmosphereSettings uniform buffer missing\")]\n    Settings,\n    #[error(\"Failed to prepare atmosphere bind groups. View uniform buffer missing\")]\n    ViewUniforms,\n    #[error(\"Failed to prepare atmosphere bind groups. Light uniform buffer missing\")]\n    LightUniforms,\n}\n\npub(super) fn prepare_atmosphere_bind_groups(\n    views: Query<\n        (\n            Entity,\n            &ExtractedAtmosphere,\n            &AtmosphereTextures,\n            &ViewDepthStencilTexture,\n            &Msaa,\n        ),\n        (With<Camera3d>, With<ExtractedAtmosphere>),\n    >,\n    render_device: Res<RenderDevice>,\n    layouts: Res<AtmosphereBindGroupLayouts>,\n    render_sky_layouts: Res<RenderSkyBindGroupLayouts>,\n    atmosphere_sampler: Res<AtmosphereSampler>,","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_pbr/src/atmosphere/resources.rs#L599-L635","documentation":"`prepare_atmosphere_bind_groups` (crates/bevy_pbr/src/atmosphere/resources.rs:668) needs a GPU binding for the per-view light uniform buffer `LightMeta.view_gpu_lights`, which the PBR light-preparation system writes each frame. If that buffer has never been written, `.binding()` returns `None` and the system returns `AtmosphereBindGroupError::LightUniforms` as a `BevyError` — Bevy's scheduler logs it and atmosphere bind groups are not created that frame.","triggerScenarios":"An extracted atmosphere-enabled `Camera3d` exists while `view_gpu_lights` is still empty: the PBR light plugin was removed or never ran (system ordering in a custom RenderApp), or a stripped-down render app added `AtmospherePlugin` without the rest of the MeshPbrPlugin machinery.","commonSituations":"Adding the atmosphere feature to a minimal/custom renderer instead of the default plugin set; disabling lighting-related plugins or reordering render-graph setup; integrating the atmosphere pass into a custom pipeline where light preparation runs later (or not at all).","solutions":["Add `AtmospherePlugin` alongside `DefaultPlugins` (which includes the PBR light pipeline), not in isolation","If you trimmed plugins, re-enable the light preparation systems so `LightMeta.view_gpu_lights` is populated before atmosphere preparation","In custom render setups, verify the atmosphere prepare system runs after light prepare in the same schedule"],"exampleFix":"// before: atmosphere plugin without the PBR light pipeline\napp.add_plugins((MinimalPlugins, AtmospherePlugin));\n\n// after: keep the standard PBR plugins alongside\napp.add_plugins((DefaultPlugins, AtmospherePlugin));","handlingStrategy":"validation","validationCode":"null","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add AtmospherePlugin only alongside DefaultPlugins (or at least the full MeshPbrPlugin), never to a MinimalPlugins-only app","Don't trim lighting systems from the render app when atmosphere is enabled","After plugin setup in dev builds, verify the render world produced non-empty light uniforms on the first frame (system log shows this error otherwise)"],"tags":["bevy","atmosphere","render","bind-group","lights","uniform-buffer"],"backgroundTag":"missing-gpu-uniform-buffer","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}