Learning Physically Based Rendering Through Progressive C++ Ray Tracing
Ray Tracing in One Weekend Series is a C++ implementation and exploration of Peter Shirley’s Ray Tracing in One Weekend book series. Rather than treating the books as isolated exercises, the project incrementally develops a reusable ray tracing framework while exploring the mathematical and software engineering principles behind physically based image generation.
Originally developed as a standalone educational project, the ray tracer is intended to become the software-rendered rendering path of the DirectX 12 Engine as its 3D systems mature. Instead of remaining an offline image generator, its rendering pipeline will ultimately integrate with the engine’s architecture, allowing ray traced scenes to coexist alongside the real-time rasterisation systems provided by the DirectX 12 backend.
The Engineering Problem
Modern rendering engines often focus exclusively on rasterization, making it difficult to explore the mathematical foundations of light transport, material interaction and physically based rendering within a structured software architecture. Conversely, many educational ray tracing implementations prioritise producing images over demonstrating maintainable engineering practices or integration into a reusable engine.
This project addresses both challenges by progressively implementing the algorithms presented throughout the Ray Tracing in One Weekend series while organising the renderer into modular components that can later transition into the wider DirectX 12 engine architecture. The result is both a learning platform for physically based rendering and a foundation for future engine integration.
My Role
I implemented the complete C++ ray tracing project, progressively developing each stage of the renderer while exploring the mathematics of ray generation, acceleration structures, material systems, textures, volumetric rendering and camera simulation presented throughout the book series.
Beyond reproducing the reference implementation, the project serves as the research and development foundation for future rendering technologies within my DirectX 12 Engine. As the engine’s 3D capabilities evolve, this work will transition from a standalone renderer into an integrated rendering backend capable of supporting physically based rendering alongside traditional rasterisation.
Architecture Overview
The project follows the progressive architecture presented throughout the book series, with each stage extending the renderer through increasingly sophisticated rendering systems while maintaining clear separation between mathematical primitives, scene construction, materials and rendering algorithms.

Core mathematical types provide vectors, rays and geometric operations. Scene objects implement common intersection behaviour through reusable interfaces, while material and texture systems determine how rays scatter and accumulate light throughout the scene. Camera and rendering systems coordinate image generation, progressively producing physically based images through recursive light transport simulation.
Core Rendering Systems
The renderer is organised into three major areas that progressively build towards a physically based rendering pipeline. Each subsystem focuses on a specific rendering responsibility while contributing to the complete image generation process.

Ray Tracing Foundations
Implements vector mathematics, rays, cameras, spheres, geometric intersections and recursive ray evaluation. These systems establish the mathematical framework required to generate images by tracing rays through virtual scenes. It is currently output to an .png image format.

Materials & Light Transport
Builds physically based material models including diffuse, metallic and dielectric surfaces together with textures, emitted light and volumetric media. Recursive scattering calculations simulate realistic reflections, refractions and global illumination throughout complex scenes.

Scene Optimisation & Future Engine Integration
Introduces acceleration structures, procedural scene construction and progressively more complex rendering features while preparing the renderer for integration into the DirectX 12 Engine. Future development will allow ray tracing to operate as a real time rendering.
Together, these systems demonstrate how physically based rendering can be developed through modular software architecture while providing a foundation for future engine integration.
Engineering Principles
| Principle | Application |
| Progressing Rendering Architecture | Develops the renderer incrementally, introducing increasingly advanced ray tracing features while building upon previously implemented mathematical and rendering systems. |
| Mathematical Foundations | Implements reusable vector mathematics, ray operations, intersection testing and geometric calculations that form the basis of physically based rendering algorithms. |
| Physically Based Rendering | Models realistic light transport through recursive ray tracing, material scattering, textures, emission and volumetric effects to produce physically accurate images. |
| Scene Representation | Organises geometry, materials, textures and cameras into modular components that separate scene construction from rendering behaviour and traversal algorithms. |
| Rendering Optimisation | Introduces acceleration structures, sampling strategies and recursive rendering techniques that improve scalability while maintaining image quality as scene complexity increases. |
| Future Engine Integration | Structures the renderer as a modular rendering system intended to transition into the DirectX 12 Engine, providing a physically based rendering path alongside the existing rasterisation backend. |
Key Design Decisions
Progressive System Development
The renderer evolves through incremental stages, allowing each rendering concept to build upon previously implemented mathematical and architectural foundations without introducing unnecessary complexity.
Modular Rendering Components
Geometry, materials, textures, cameras and rendering algorithms remain separate systems with clearly defined responsibilities, improving maintainability while simplifying future extension.
Mathematical Separation
Vector mathematics, intersection testing, sampling and light transport are implemented independently from scene construction, enabling rendering algorithms to remain reusable across different environments.
Future Engine Integration
Although currently operating as a standalone renderer, the project is structured to support migration into the DirectX 12 Engine, allowing physically based rendering to complement the engine’s existing rendering architecture rather than replacing it.
Technologies
Development
C++ 20
Visual Studio 2022
Git
Git Submodules
Engineering Approach
Physically Based Rendering
Recursive Ray Tracing
Monte Carlo Sampling
Computational Geometry
Bounding Volume Hierarchies
Object-Oriented Design
Separation of Concerns
Modular Architecture
Progressive System Design
Rendering Pipeline Development
Engineering Outcome
Ray Tracing in One Weekend Series demonstrates the implementation of physically based rendering techniques through a modular C++ architecture while exploring the mathematical principles behind modern rendering. Beyond serving as a learning platform, the project establishes the research foundation for future ray tracing support within the DirectX 12 Engine, enabling offline and real-time rendering technologies to share a common architectural framework.
Application Gallery



Repository
Explore the source code to see how the DirectX 12 backend implements platform initialisation, graphics infrastructure and the reusable engine interfaces that will support future 2D and 3D rendering systems.
