shadowVisibility

How much of a light reaches a point, 1 when nothing is in the way and 0 when the shape blocks it.

shadowVisibility(spec: ShadowSpec): Expr

Import radiance from shaders/std and use radiance.shadowVisibility.

Casts a ray from from toward the light and stops at the shape. Values between 0 and 1 are the soft edge of the shadow, wider with softness. Multiply a light's contribution by it.

Parameters

NameTypeNotes
specShadowSpec

Example

const lit = math.mul(strength, shadowVisibility({from: math.add(edge.point, math.mul(edge.normal, math.mul(px, 2))), toward: light.uv, field: far.at, steps: 12, surfaceEps: px, softness: u.shadowSoftness}))

Tip. Start from two pixels off the edge along its normal or the point shadows itself.

See also

  • gatherIrradiance — The light arriving at a pixel from a glowing shape edge, with the shape's body blocking it.
  • irradianceField — The light spilling from a shape's edges, gathered once into a texture and read per pixel.

Used by

Irradiance