Overview
Stage lights, searchlights and light through a church window all share a look: a visible beam, with moving objects casting dark streaks through it. This lab builds that look without the cost of full volumetric rendering by pairing a real shadow-casting SpotLight with an additive beam mesh, and animating occluders through the light so you can see the interaction.
How it works
The effect has two layers that are tuned together:
- The light. A
SpotLightwith shadows enabled lights the floor and objects. Itsangleandpenumbradefine the cone, and its shadow camera is a perspective camera that matches that cone, so the shadows of the moving blockers land correctly on the floor. - The beam. A cone mesh aligned with the light uses additive blending and partial transparency to represent light scattered by the air. Combined with
FogExp2, distant parts of the scene fade into haze so the beam has something to "light up".
The moving boxes cast real shadows on the floor while passing through the visible cone, which is what persuades the eye that the beam is a volume of light. A SpotLightHelper can be shown to visualise the cone geometry the two layers share.
Exploring the demo
Change the cone angle and penumbra and watch the beam and the pool on the floor change together. Raise fog density for a smoky, concert-like look, and lower it for a subtle shaft. Follow a moving blocker: its floor shadow is real, but the beam itself does not darken behind it, which is the main limitation of a mesh-based beam compared with raymarching.
Where to go next
True volumetric lighting raymarches through the beam, sampling the shadow map at each step, so occluders cut dark gaps into the shaft itself. That is more expensive but sometimes worth it for hero shots. Compare the simpler god rays and fog scattering demos, see measured real-world beam shapes in IES profiles, and explore full volumes in raymarched clouds.