Skip to main content

ambient_occlusion_sample

Function ambient_occlusion_sample 

Source
pub fn ambient_occlusion_sample(
    hit: &HitRecord,
    triangles: &[GpuTriangle],
    n_samples: usize,
) -> f32
Expand description

Estimate ambient occlusion at a hit point by sampling hemisphere directions.

n_samples rays are fired in directions cosine-weighted around hit.normal. Returns the fraction of rays that are not occluded (1.0 = fully lit).