Spotlight

July 24, 2026

A spotlight that flickers on and swings into place over a sphere of 5,200 particles, originally made for Recs but scrapped before release. Drag to spin the sphere.

The beam is a cone mesh shaded in GLSL, with falloff along its length and a soft edge based on the angle to the camera. The sphere casts a shadow through the beam, and the pool of light on the floor is its own shader. The swing is a spring, with the floor pool following wherever the beam lands.

float dist = distance(vWorldPos, uTipPos);
float linear = 1.0 - clamp(dist / uAttenuation, 0.0, 1.0);
float invSq = 1.0 / (1.0 + dist * dist * 0.06);
float axial = mix(linear * linear, invSq, 0.55);

Made with GLSL, Three.js and React Three Fiber (R3F).

- Joey