Voxel Chunk Stress Test

Minecraft-style voxel chunks testing geometry merging vs individual meshes.

Controls

Chunk Size

2
16
import * as EASEL from "easel";

const scene = new EASEL.Scene();
const camera = new EASEL.PerspectiveCamera({
  fov: 60, aspect: width / height, near: 0.1, far: 200,
});
const renderer = new EASEL.Renderer({ canvas, width, height });
scene.add(new EASEL.AmbientLight(0xffffff, 0.4));

const size = 8;
const half = size / 2;

// Individual mode: one Mesh per voxel
const boxGeo = new EASEL.BoxGeometry(1, 1, 1);
for (let x = 0; x < size; x++) {
  for (let y = 0; y < size; y++) {
    for (let z = 0; z < size; z++) {
      if (x > 0 && x < size-1 && y > 0 && y < size-1
          && z > 0 && z < size-1) continue; // hollow
      const color = y === size-1 ? 0x44aa44
        : y > 0 ? 0x886644 : 0x888888;
      const mesh = new EASEL.Mesh(boxGeo,
        new EASEL.LambertMaterial({ color }));
      mesh.position.set(x - half + 0.5, y - half + 0.5, z - half + 0.5);
      scene.add(mesh);
    }
  }
}

// Merged mode: build a single Geometry with all faces
// const geo = new EASEL.Geometry();
// geo.setPositions(allPositions);
// geo.setNormals(allNormals);
// geo.setUVs(allUVs);
// geo.setColors(allColors);
// geo.setIndex(allIndices);
// scene.add(new EASEL.Mesh(geo, new EASEL.LambertMaterial({ color: 0xffffff })));