Point Cloud Stress Test

Stress test the PointRasterizer with large vertex counts.

Controls

Point Count

100
50000

Point Size

1
8
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.5));

// Random points inside a sphere (rejection sampling)
const positions = new Float32Array(count * 3);
const colors = new Float32Array(count * 3);
let i = 0;
while (i < count) {
  const x = (Math.random() * 2 - 1) * 3;
  const y = (Math.random() * 2 - 1) * 3;
  const z = (Math.random() * 2 - 1) * 3;
  if (x * x + y * y + z * z > 9) continue;
  positions.set([x, y, z], i * 3);
  colors.set([Math.random(), Math.random(), Math.random()], i * 3);
  i++;
}

const geometry = new EASEL.Geometry();
geometry.setPositions(positions);
geometry.setColors(colors);

const material = new EASEL.PointsMaterial({ size: 2 });
const points = new EASEL.Points(geometry, material);
scene.add(points);