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
shadow ray casting
penumbra softness factor k
soft shadow formula
shadow bias
Try this shader live in the Shader Sandbox editor with real-time preview.