Raytracing on the CPU
CPU based Raytracer for voxels in C++
🎓 About the Block
This project was part of my university curriculum, where the goal was to implement a raytracing engine in 8 weeks using the provided template, focusing on voxel-based rendering. I designed and developed the core raytracing algorithm, which runs entirely on the CPU, allowing it to simulate lighting effects like shadows, reflections, and refractions.
The project served as my introduction into graphics programming.
📂 Source Code & Template
The game is based on a template I received during the block, which you can find here on GitHub.
🛠️ Technologies Used
- C++: Developed core game logic and the raytracing algorithm.
- GLFW: Managed graphics rendering, window handling, and input events to streamline the interface.
- ImGui: Used to create an user interface for real-time control over raytracing parameters like light intensity and reflection settings.
⚙️ Key Highlights
Voxel-Based Raytracing
Beer’s Law for Light Absorption
Area Lighting for Soft Shadows
- Optimization Techniques: Optimized the raytracing algorithm with:
- Multithreading: Using multithreading to distribute ray calculations across multiple CPU cores.
- SIMD (Single Instruction, Multiple Data): Applied SIMD instructions to process multiple rays simultaneously, increasing speed.
📚 Project Articles
Throughout the project, I documented my learning and development process in a series of articles. These posts dive deeper into the various aspects of building a CPU-based raytracer and cover aspects of this project in detail:
- Learning-Raytracing-in-8-weeks | Area Lights | Part 1 -n introduction to the project, focusing on area lights and realistic shadow casting.
- Learning-Raytracing-in-8-weeks | Glass made out of voxels | Part 2 Techniques for simulating glass effects in a voxel-based raytracer.
- Learning-Raytracing-in-8-weeks | Transforming voxel volumes | Part 3 A discussion on implementing transformations within voxel volumes.
- Learning-Raytracing-in-8-weeks | Simple Smoke with Beer’s Law | Part 4 An exploration of Beer’s Law to simulate light absorption for semi-transparent objects like smoke.