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 visibility factor in the range 0.0..=1.0 for the segment from origin to light_pos.

Despite the historical name this is binary, not soft: 1.0 when nothing blocks the segment, 0.0 when anything does. No penumbra is sampled. Callers that hold real geometry should use LightingUniforms::shade_with_visibility with a callback instead; this is the bounded fallback for callers holding only (center, radius) bounding spheres, which necessarily over-shadow a ray passing through empty space beside an occluder.

§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.