Skip to main content

compute_lambert

Function compute_lambert 

Source
pub fn compute_lambert(
    light: &Light,
    normal: Vector3D,
    material: &Material,
) -> Vector3D
Expand description

Computes the Lambertian (diffuse) contribution of a single light at a shaded surface point.

color * intensity * albedo * max(0, dot(normal, light_dir))

light_dir is the unit direction from the surface toward the light; any falloff must already be folded into a scaled intensity by the caller.

A thin wrapper over [lambert_term], which takes the same quantities unpacked instead of through a Light, so a direct call and the same light routed through LightingUniforms::shade_with_visibility share one implementation.

§Arguments

  • &Light - The light source being evaluated.
  • Vector3D - The surface normal (expected to be unit length).
  • &Material - The material at the shaded point.

§Returns

  • Vector3D - The diffuse contribution of this light.