Light Types

Compare Directional, Point, Spot, and Hemisphere lights on a sphere and ground plane.

Controls

Intensity

0
2
import * as EASEL from "easel";

const scene = new EASEL.Scene();
const camera = new EASEL.PerspectiveCamera({
  fov: 45,
  aspect: width / height,
  near: 0.1,
  far: 100,
});
camera.position.z = 8;
camera.position.y = 2;

scene.add(new EASEL.AmbientLight(0xffffff, 0.15));

// Directional: parallel rays, position sets direction only
const dir = new EASEL.DirectionalLight(0xffffff, 1);
dir.position.set(3, 5, 4);

// Point: per-vertex distance attenuation (distance, decay)
const point = new EASEL.PointLight(0xffffff, 1, 20, 2);
point.position.set(2, 3, 2);

// Spot: cone light (distance, angle, penumbra, decay)
const spot = new EASEL.SpotLight(0xffffff, 1, 20, Math.PI / 6, 0.5, 2);
spot.position.set(2, 4, 2);

// Hemisphere: sky/ground color blend per vertex normal
const hemi = new EASEL.HemisphereLight(0x8888ff, 0x443322, 1);