Overview
In clear air a spotlight beam is invisible; you only see where it lands. Add fog, smoke or dust and the beam itself becomes visible, because particles in the air scatter some of the light towards your eye. This demo combines Three.js exponential fog with an additive beam mesh to approximate that effect cheaply, and lets you see how fog density and the spotlight's shape interact.
How it works
THREE.FogExp2 blends every fragment towards a fog colour based on its distance from the camera: factor = 1 − exp(−(density × distance)²). Unlike linear fog, it has no hard start and end distances and looks more natural for atmospheric haze. It fades distant geometry, which gives depth, but it does not create light shafts on its own.
The shaft comes from a cone mesh aligned with a SpotLight. The cone uses additive blending and a procedural gradient texture drawn on a canvas, brightest near the light and fading along its length, which hides the banding a flat colour would show. As the spotlight's target sweeps around the scene, the cone follows it, and the real spotlight lights the floor and objects underneath. Changing the spotlight's penumbra changes both the softness of the pool on the floor and the beam's edge falloff, so the two stay visually consistent.
Exploring the demo
Increase fog density and notice that two things happen together: distant objects fade into the haze and the beam reads more strongly. Then soften the penumbra and watch both the pool and the shaft edges blur. Pause the sweep and orbit around the beam to judge it from different angles.
Practical advice
Tie beam opacity to fog density in your own scenes; a bright beam in clear air looks wrong. For a version with real shadows cast through the beam, see the volumetric spotlight lab; for the simplest form of the trick, see god rays; and for true volumetric scattering, explore the raymarched clouds.