{"record":{"id":"6f2fb22b8fa8fc92","repo":"BabylonJS/Babylon.js","slug":"atmosphere-is-not-supported-on-webgl-engine-vers","errorCode":null,"errorMessage":"Atmosphere is not supported on WebGL ${engine.version}.","messagePattern":"Atmosphere is not supported on WebGL (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/addons/src/atmosphere/atmosphere.ts","lineNumber":678,"sourceCode":"     * Constructs the {@link Atmosphere}.\r\n     * @param name - The name of this instance.\r\n     * @param scene - The scene to which the atmosphere will be added.\r\n     * @param lights - The light sources that illuminate the atmosphere. Currently only supports one light, and that light should be the first light in the scene.\r\n     * @param options - The options used to create the atmosphere.\r\n     */\r\n    public constructor(\r\n        public readonly name: string,\r\n        public readonly scene: Scene,\r\n        lights: DirectionalLight[],\r\n        options?: IAtmosphereOptions\r\n    ) {\r\n        RegisterEngineUniformBuffer();\r\n        RegisterEnginesExtensionsEngineRenderTarget();\r\n\r\n        const engine = (this._engine = scene.getEngine());\r\n\r\n        if (!engine.isWebGPU && engine.version < 2) {\r\n            throw new Error(`Atmosphere is not supported on WebGL ${engine.version}.`);\r\n        }\r\n\r\n        this._physicalProperties = options?.physicalProperties ?? new AtmospherePhysicalProperties();\r\n        this._physicalProperties.onChangedObservable.add(() => {\r\n            this._transmittanceLut?.markDirty();\r\n        });\r\n\r\n        if (lights.length !== 1) {\r\n            throw new Error(\"Atmosphere only supports one light source currently.\");\r\n        }\r\n        this._lights = lights;\r\n\r\n        this.depthTexture = options?.depthTexture ?? null;\r\n        this._exposure = options?.exposure ?? 1.0;\r\n        this._isLinearSpaceLight = options?.isLinearSpaceLight ?? false;\r\n        this._isLinearSpaceComposition = options?.isLinearSpaceComposition ?? false;\r\n        this._applyApproximateTransmittance = options?.applyApproximateTransmittance ?? true;\r\n        this._aerialPerspectiveRadianceBias = options?.aerialPerspectiveRadianceBias ?? 0.0;\r","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/addons/src/atmosphere/atmosphere.ts#L660-L696","documentation":"The Atmosphere addon implements physically-based sky rendering that relies on compute-shader-like features only available on WebGPU or WebGL2. During construction it checks the engine type and version, and throws if the engine is a WebGL1 (version < 2) engine. The library intentionally refuses to run its LUT generation and rendering pipeline on engines that cannot support it.","triggerScenarios":"Calling `new Atmosphere(scene, lights, options)` (or creating it via any helper) while the scene's engine is a WebGL1 engine, i.e. `engine.isWebGPU === false && engine.version < 2`.","commonSituations":"Projects still targeting WebGL1 for legacy browser/device support, using `Engine` (not `WebGL2Engine`/`WebGPUEngine`) on a context that fell back to WebGL1, or old environments (e.g. older Safari/iOS) where WebGL2 is unavailable and the engine falls back.","solutions":["Create the engine as a WebGL2 engine (new BABYLON.Engine(canvas, true) resolves to WebGL2 when available) or use WebGPUEngine via WebGPUEngine.IsSupportedAsync.","Check engine capability before constructing: `if (!engine.isWebGPU && engine.version < 2) { ... }` and skip/replace Atmosphere with a fallback sky (e.g. SkyMaterial or procedural sky).","Fix the environment so WebGL2 is available (update browser/GPU drivers, enable hardware acceleration) if WebGL1 was an unintended fallback."],"exampleFix":"// before\nconst engine = new BAB.Engine(canvas, false, { webglOptions: {} }); // may end up WebGL1\nconst atmosphere = new Atmosphere(scene, [light]); // throws on WebGL1\n// after\nif (engine.isWebGPU || engine.version >= 2) {\n  const atmosphere = new Atmosphere(scene, [light]);\n} else {\n  // fallback sky for WebGL1\n  const sky = new BAB.SkyMaterial(\"sky\", scene);\n}","handlingStrategy":"validation","validationCode":"function canUseAtmosphere(engine: BABYLON.AbstractEngine): boolean {\n  return engine.isWebGPU || engine.version >= 2;\n}\nif (!canUseAtmosphere(engine)) { /* use fallback sky */ }","typeGuard":"const isAtmosphereCapable = (e: BABYLON.AbstractEngine): e is BABYLON.AbstractEngine & { version: 2 } =>\n  e.isWebGPU || e.version >= 2;","tryCatchPattern":"try {\n  atmosphere = new Atmosphere(scene, [sun]);\n} catch (e) {\n  if (String(e).includes(\"not supported on WebGL\")) {\n    atmosphere = null; // fall back to SkyMaterial\n  } else throw e;\n}","preventionTips":["Target WebGL2/WebGPU as minimum; verify engine.version at startup.","Add a capability check before constructing any advanced addon.","Test on minimum-spec browsers/devices (old Safari, software GL)."],"tags":["webgl","webgpu","engine-version","atmosphere","initialization"],"backgroundTag":"unsupported-engine-capability","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}