Skip to main content

march_implicit_surface

Function march_implicit_surface 

Source
pub fn march_implicit_surface<F>(
    camera: &Camera,
    options: &ImplicitRenderOptions,
    sdf: F,
) -> ScreenImageItem
where F: Fn(Vec3) -> f32 + Sync,
Expand description

Sphere-march a signed-distance function and produce a depth-composited ScreenImageItem.

Each pixel fires a ray from the camera and sphere-marches by calling sdf. Hit points are shaded with simple diffuse + ambient lighting derived from the SDF gradient (6 extra SDF evaluations per hit point via central differences).

The returned item has depth: Some(depths). Background pixels carry depth 1.0 (far plane) so scene geometry is never occluded by them.

See the module-level documentation for a usage example.