Shadow rays use the same raymarching loop from the shading point toward the light to determine occlusion
Hard shadows in SDF rendering use a second raymarching pass. Starting from the surface point (offset slightly along the normal to prevent self-intersection) and marching toward the light source, if the ray hits any geometry before reaching the light the point is in shadow. This reuses the same map() function used for primary rays — the visibility query is identical, just launched from a different origin in a different direction. The shadow factor multiplies the key-light contribution: 0 for full shadow, 1 for full light.
Examples
float shadow = castShadow(pos + nor*0.001, sunDir); — positive normal offset prevents the point from immediately intersecting its own surface.
Assessment
Explain why the shadow ray must be offset from the surface along the normal before it starts marching, and what artifact you get if you omit the offset.