Compute Color from Light and Surface
An object looks different when lit directly and at an angle. Lighting depends on surface direction, light direction, and material.
A simple diffuse model
The Lambert model for matte surfaces uses unit normal N and unit direction L from the surface toward the light. Its factor is max(0, N·L), clamped to avoid negative light from behind the surface.
normal = (0, 0, 1)
light = (0, 0.8, 0.6)
dot = sum(n * l for n, l in zip(normal, light))
diffuse = 0.8 * max(0, dot)
print(round(diffuse, 2))
The result is 0.48: a dot product of 0.6 multiplied by reflectance 0.8. This is a simplified linear brightness calculation with unit light intensity, not directly a stored sRGB value.
Highlights depend on viewing direction
Specular reflection produces highlights that depend on view and reflection directions. The classic Phong lighting model approximates illumination using ambient, diffuse, and specular terms. A constant ambient term does not fully calculate real light bouncing through a scene.
Shadows also require visibility calculations. A normal and dot product do not automatically detect another object blocking the light.
Check your understanding
With unit normal (0,0,1) and light direction (1,0,0), what is the diffuse term?
Show explanation
Zero, because the dot product is zero: the light grazes the surface. Other lights or indirect illumination may still contribute, so this does not necessarily make the final image black.