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.
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.
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.
Lights & Shadows
Visibility is calculated using both binary and transparency-based methods. Debug rays visualize the path from intersection points to light sources.
Area Lights
Implemented segment and parallelogram lights to create realistic soft shadows. These require multiple samples per pixel to converge.
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.
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.