RayTracing

Highlights⌗
- Sources
- Created in 2020
Description⌗
A 3D engine written in C++ with the ambition to perform real-time ray tracing on CPU.
Capabilities:
- Transparency
- Glare
- Refraction dependent on the refractive index of the material
- Reflection
- Optimized trigonometry with Taylor polynomials
- Render cubes and half-cubes
- Render exclusively on the CPU
- Multi-threaded
- 100 fps in 150x100 px, 1 fps in 1920x1080 px
In order to simplify computations, the Ray Tracing part only uses one ray per pixel. This is configurable, but requires more compute power.
The textures are from Minecraft 1.15.
This project allowed me to render pictures I still use today.
Context⌗
When Minecraft with RTX (now Minecraft Bedrock Edition) was announced in 2020, I felt it would be interesting to create a new engine with simple algorithms.
I decided to restrict myself to CPU in the first place to keep the project simple.
This was not the first 3D engine I made: I started with a simple sort each face by z-index, then draw the image with a certain matrix transformation application. Then, I wrote a BASIC Casio program to display simple shapes on a Graph-35+.
I chose Qt because of its familiarity and the ease with which it allows pixel-by-pixel painting without having to learn Windows-specific events.
Later, I moved the project to CMake and Wingdi in order to try the Windows way of drawing. Then, I tried OpenCL to utilize the GPU for ray computing, but not actual rendering. The Qt version is still more mature, though.
Overview⌗
2020⌗
![]() | ![]() |
---|
2021⌗
Mirrors | Infinite mirrors |
---|---|
![]() | ![]() |
Real time refresh | Logo |
![]() | ![]() |
Refraction | Water |
![]() | ![]() index of 1.33 illustrates diffraction. |
Refraction | Water |
Noise viewer⌗
A friend of mine asked to render 3D Perlin noise. The results are fascinating.
The value of the noise is represented by the color of the block of their transparency.
16x16x16 |
---|
The cube has a hole where the noise is weaker, and there are white blocks where it is stronger. |
32x32x32 |
![]() Values are forming clusters depending on the type of block. |
![]() |
64x64x64 |
![]() |
Experiments⌗
![]() | |
---|---|