The goal of this stage was to implement physically based lighting and introduce shadows, allowing the renderer to simulate how light interacts with surfaces in a realistic way.
Diffuse lighting was implemented using Lambert’s cosine law, which models how light scatters off rough surfaces. At each ray–object intersection, the surface normal is compared with the direction to a point light source using a dot product. This determines how bright the surface appears based on its orientation relative to the light.
To improve realism, shadow rays were introduced. After a surface is hit, a secondary ray is cast toward the light source to test whether another object blocks the light. If an intersection occurs before the light is reached, the surface is considered to be in shadow and only receives ambient illumination.
This stage marks a major step toward realism. Objects are no longer just shaded based on orientation but now respond to light visibility within the scene. The renderer now produces images with clear depth cues, lighting direction, and object shadows, all derived from physically meaningful ray calculations.
Log in to leave a comment