advanced

#23 Soft Shadows

Penumbra shadows in raymarching

To compute shadows in raymarching, cast a ray from the surface point toward the light. If it hits something, the point is in shadow. For soft shadows, track the closest pass near any surface along the shadow ray using min(k * d / t, 1.0) where k controls penumbra softness. Larger k means sharper shadows.

Key Concepts

Try this shader live in the Shader Sandbox editor with real-time preview.
Open in Sandbox

Source Code


    
← Previous Reflections Next → Fog & Atmosphere

All Tutorials