Skip to content
Projects

About

Dynamic global Illumination addon for three.js

Creative & Media

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Speedball GI

Real-time BVH-traced dynamic diffuse global illumination for three.js WebGPU and its WebGL2 fallback. Speedball keeps solving during motion; structural rebuilds wait for a safe idle window.

Launch the Sponza demo

Install

npm install speedball-gi three three-mesh-bvh

Speedball supports Three r185 through r187:

{
  "three": ">=0.185.0 <0.188.0",
  "three-mesh-bvh": ">=0.9.11 <0.10.0"
}

Quick start

Install GI before the first render or renderer.setAnimationLoop() call.

import { installSpeedballGI } from 'speedball-gi';

const gi = installSpeedballGI({
  renderer,
  scene,
  camera,
  intensity: 10,
  divisions: 16,
  rays: 64,
  cascades: 1,
  jitterMode: 'gated',
  onError: console.error,
});

renderer.setAnimationLoop(async () => {
  gi.update();
  await renderer.renderAsync(scene, camera);
});

// Dispose GI before renderer and scene resources.
function dispose() {
  gi.dispose();
  renderer.dispose();
}

Continuous solving is enabled by default. gated holds a stable sampling basis for low-latency, mostly flicker-free lighting. montecarlo refreshes the basis every solve for maximum discovery and expects more hysteresis.

GI selects the initialized renderer backend automatically. To force WebGL2, use new THREE.WebGPURenderer({ forceWebGL: true }); the GI API stays the same. WebGL2 requires EXT_color_buffer_float. The classic THREE.WebGLRenderer is not supported. Try the demo with ?renderer=webgl.

Dynamic scenes

The default integration detects scene changes automatically. Engines and editors that already know what changed can disable those scans and send exact events:

const gi = installSpeedballGI({
  renderer,
  scene,
  camera,
  autoDetectChanges: false,
});

gi.markTransformsDirty(mesh);
gi.markDeformsDirty(streamedMesh);
gi.markMaterialValuesDirty(material);
gi.forceLightingRefresh();
gi.markTopologyDirty();

Use excludeFromGI(object) for sky domes, helpers, and gizmos. The installer supports one active probe field per module instance.

Documentation

License

MIT — see LICENSE.

Explore related projects

Loading…