BabylonJS/Babylon.js · error

The ComputeShaderParticleSystem class is not available! Make

Error message

The ComputeShaderParticleSystem class is not available! Make sure you have imported it.

What it means

GPUParticleSystem selects its compute-shader backend platform by looking up the registered class "BABYLON.ComputeShaderParticleSystem" via the class registry. On engines supporting compute shaders, that class must be registered — it lives in a separate ES6 module import. If only the core/pure build is loaded without the side-effect module that registers the class, GetClass returns undefined and the system throws.

Source

Thrown at packages/dev/core/src/Particles/gpuParticleSystem.pure.ts:1098

        isAnimationSheetEnabled: boolean = false
    ) {
        RegisterAnimatable();
        super(name);

        if (!sceneOrEngine || sceneOrEngine.getClassName() === "Scene") {
            this._scene = (sceneOrEngine as Scene) || EngineStore.LastCreatedScene;
            this._engine = this._scene.getEngine();
            this.uniqueId = this._scene.getUniqueId();
            this.layerMask = this._scene.defaultRenderableLayerMask;
            this._scene.particleSystems.push(this);
        } else {
            this._engine = sceneOrEngine as AbstractEngine;
            this.defaultProjectionMatrix = Matrix.PerspectiveFovLH(0.8, 1, 0.1, 100, this._engine.isNDCHalfZRange);
        }

        if (this._engine.getCaps().supportComputeShaders) {
            if (!GetClass("BABYLON.ComputeShaderParticleSystem")) {
                throw new Error("The ComputeShaderParticleSystem class is not available! Make sure you have imported it.");
            }
            this._platform = new (GetClass("BABYLON.ComputeShaderParticleSystem"))(this, this._engine);
        } else {
            if (!GetClass("BABYLON.WebGL2ParticleSystem")) {
                throw new Error("The WebGL2ParticleSystem class is not available! Make sure you have imported it.");
            }
            this._platform = new (GetClass("BABYLON.WebGL2ParticleSystem"))(this, this._engine);
        }

        this._customWrappers = { 0: new DrawWrapper(this._engine) };
        this._customWrappers[0]!.effect = customEffect;

        this._drawWrappers = { 0: new DrawWrapper(this._engine) };
        if (this._drawWrappers[0].drawContext) {
            this._drawWrappers[0].drawContext.useInstancing = true;
        }

        this._createIndexBuffer();

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Import the full ES6 bundle or add the side-effect import that registers ComputeShaderParticleSystem (e.g. import from the package index or the computeShaderParticleSystem module).
  2. Force the WebGL2 path by using an engine without compute shader support if the compute path is not desired.
  3. Verify the imported build flavor: UMD/legacy builds include registration; cherry-picked pure modules do not.

Example fix

// before
import { GPUParticleSystem } from "@babylonjs/core/Particles/gpuParticleSystem";
// after: also import side-effect module that registers the class
import "@babylonjs/core/Particles/computeShaderParticleSystem";
// or simply
import { GPUParticleSystem } from "@babylonjs/core";
Defensive patterns

Strategy: validation

Validate before calling

if (engine.getCaps().supportComputeShaders) {
  import("@babylonjs/core/Particles/computeShaderParticleSystem"); // ensure registered
}

Try / catch

try {
  const ps = new GPUParticleSystem("p", { capacity: 1000 }, engine);
} catch (e) {
  if (e.message.includes("ComputeShaderParticleSystem")) {
    console.error("Missing side-effect import for WebGPU GPU particles");
  }
}

Prevention

When it happens

Trigger: Constructing new GPUParticleSystem(...) on an engine whose caps.supportComputeShaders is true (WebGPU or compute-capable backend) while the module registering ComputeShaderParticleSystem was never imported.

Common situations: Tree-shaken or side-effect-free ES6 imports (importing only gpuParticleSystem without the compute-shader platform module), switching a project from WebGL to WebGPU where the WebGPU-specific side-effect import is missing, or using pure/core builds instead of the full ES6 index.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/e260a10d874fa1fe. Report an issue: GitHub.