Multi-Light Stress Test
Measure lighting cost by adjusting the number of point lights in the scene.
Controls
Light Count
1
32
import * as EASEL from "easel";
const scene = new EASEL.Scene();
const camera = new EASEL.PerspectiveCamera({
fov: 50, aspect: width / height, near: 0.1, far: 100,
});
camera.position.set(0, 2, 8);
const renderer = new EASEL.Renderer({ canvas, width, height });
scene.add(new EASEL.AmbientLight(0xffffff, 0.2));
const sphere = new EASEL.Mesh(
new EASEL.SphereGeometry(1.5, 32, 24),
new EASEL.LambertMaterial({ color: 0xcccccc }),
);
scene.add(sphere);
// Ring of coloured point lights orbiting the sphere
const colors = [0xff4444, 0x44ff44, 0x4444ff, 0xffff44, 0xff44ff, 0x44ffff];
for (let i = 0; i < lightCount; i++) {
const pl = new EASEL.PointLight(colors[i % 6], 1, 10, 2);
const a = (i / lightCount) * Math.PI * 2;
pl.position.set(Math.cos(a) * 4, 0, Math.sin(a) * 4);
scene.add(pl);
}