Skip to main content

soft_shadow_factor

Function soft_shadow_factor 

Source
pub fn soft_shadow_factor(
    origin: Vector3D,
    light_pos: Vector3D,
    occluders: &[(Vector3D, f64)],
) -> f64
Expand description

Computes a soft-shadow visibility factor in the range 0.0..=1.0.

Casts a single ray from origin toward light_pos and checks whether any sphere in occluders blocks the path. Returns 1.0 when no occluder is intersected, otherwise returns 0.0 (binary shadow). A future refinement could sample multiple rays to approximate penumbra.

§Arguments

  • Vector3D - The surface point casting the shadow ray.
  • Vector3D - The light position to test against.
  • &[(Vector3D, f64)] - A slice of (center, radius) occluder spheres.

§Returns

  • f64 - 1.0 if the light is visible, 0.0 if fully occluded.