A high-performance C++ ray tracer implementation featuring advanced rendering capabilities including materials, reflections, transparency, and multithreaded rendering for dramatic performance improvements.
Demonstrating various material properties and textures
Realistic reflections with proper light interaction and surface properties
Transparent objects with proper refraction and light transmission
The renderer features significant performance improvements through multithreaded rendering:
| Before Multithreading | After Multithreading |
|---|---|
![]() |
![]() |
| After Multithreading |
|---|
![]() |
Performance gains achieved through:
- Parallel pixel processing across multiple CPU cores
- Optimized ray-object intersection algorithms
- Efficient memory management for concurrent operations
- Dramatic reduction in rendering time for high-resolution images. Notice: the 800x600 runtime after multithreading is faster than the 200x300 before the optimization!
- Advanced Materials: Support for diffuse, specular, and ambient lighting
- Reflections: Realistic surface reflections with proper light interaction
- Transparency: Transparent objects with refraction effects
- Geometric Primitives: Spheres and planes with transformation support
- Camera System: Configurable field of view and resolution
- Multithreaded Rendering: Significant performance improvements through parallel processing
- PPM Output: Standard image format for easy viewing and conversion
- Comprehensive Testing: Full test suite covering all rendering components
- CMake 3.10 or higher
- C++17 compatible compiler
- Make
-
Create and navigate to build directory:
mkdir build cd build -
Configure with CMake:
cmake ..
-
Build everything:
make
cd build
ctestcd build
ctest --verbosecd build
ctest -R TupleTests
ctest -R CanvasTests
ctest -R CameraTests
# ... or any other test namecd build
./tests/TupleTests
./tests/CanvasTests
./tests/CameraTests
# ... or any other test executablecd build
make testscd build
make ray_tracercd build
./src/ray_tracerTupleTests- Tuple operations and transformationsCanvasTests- Canvas rendering and PPM outputCameraTests- Camera functionality and ray generationColorTests- Color operations and blendingIntersectionTests- Ray-object intersection calculationsMatrixTests- Matrix operations and transformationsPatternTests- Material patterns and texturesPlaneTests- Plane geometry and intersectionsRayTests- Ray operations and transformationsSphereTests- Sphere geometry and intersectionsTransformationTests- Object transformationsLightTests- Lighting calculations and shadingWorldTests- Scene composition and rendering
# Build everything
make
# Run all tests
ctest
# Build and run ray tracer
make ray_tracer && ./src/ray_tracer
# Build specific test
make TupleTests
# Run specific test
./tests/TupleTests


