Computer Graphics

Ray Tracing Engine

A CPU-based ray tracer exploring advanced lighting models, shadows, and post-processing effects. Built from scratch to understand the fundamentals of light transport.

01

Core Features

The engine implements a complete ray-tracing pipeline including:

  • BVH Traversal: Efficient bounding volume hierarchy for fast ray-scene intersections.
  • Lighting Models: Support for Point, Segment, and Parallelogram area lights.
  • Post-Processing: Bloom and Depth of Field effects applied after rendering.
02

Shading Models

Implemented and compared multiple shading models including Phong, Blinn-Phong, and a custom Linear Gradient shader. The comparison model below highlights the differences in specular highlights.

  • Red: Phong dominant (sharp, intense highlights).
  • Cyan: Blinn-Phong dominant (broader, softer highlights).
  • Gray: Similar contribution.
Linear Gradient
Linear Gradient Interpolation Test
03

Lights & Shadows

Visibility is calculated using both binary and transparency-based methods. Debug rays visualize the path from intersection points to light sources.

04

Area Lights

Implemented segment and parallelogram lights to create realistic soft shadows. These require multiple samples per pixel to converge.

Segment Light
Uniform sampling along a segment light source.
05

Bloom Effect

The bloom pipeline extracts bright pixels using a threshold, blurs them using a separable Gaussian filter with binomial coefficients, and adds them back to the scene.

06

Depth of Field

Simulates a thin lens camera. For each pixel, multiple rays are generated by sampling random points on a lens disk, directing them towards a focal point on the image plane.

Focal Point
Debug view: Rays converging at the focal point.