This project is based on https://raytracing.github.io/ and includes some additional twists like curved space.
Note: For a conventional linear ray tracer see commit b6bbcfe.
Created with build/examples/basic_swirl
(version ee5499f) using swirl_strength = 0.01
and resolution_factor = 4
.
Created with build/examples/basic_twisted_orb
(version f952428) using twist_angle = -6.0
, resolution_factor = 4
, ray_error_abs = 1e-12
and ray_depth = 10000
.
Created with build/examples/schwarzschild
(version e931515) using speed_of_light = 100.0
, schwarzschild_radius = 1.0
, resolution_factor = 4
, ray_error_abs = 1e-8
and ray_depth = 75
. Took 303min12sec user time (intel i5-4590).
instant_speed_of_light_60fps.mp4
Conventional 3D raytracing with infinite speed of light (for reference).
The 3D spheres grow and shrink over time.
All textures are time-independent.
Everything appears to be synchronized.
Created with build/examples/basic_minkowski
(version 9693243b).
fixed_speed_of_light_60fps.mp4
4D raytracing in Minkowski space with a finite speed_of_light=7.0
.
Shown are 4D spheres (glomes) which appear to change size over time.
All textures are 4D time-dependent chess board patterns and change color for every unit of space or time.
The finite speed reults in distant events appearing to be delayed.
Created with build/examples/basic_minkowski
(version 9693243b).
slow_speed_of_light_0_to_20_60fps.mp4
Same setup as before but for varying speed_of_light
(0
to 20
) for a fixed moment in time.
The faster the speed of light, the shorter the aparrent delay between two spatial regions.
Created with build/examples/basic_minkowski
(version 27d8af63).
Diffuse, Dielectric, Metal & Emission
Wheel in Motion.
Resting.
- Multi-Threaded
- Rendering (fully)
- BVH Tree Generation (partially)
- Bounding Volume Hierachy (BVH)
note: The image in the middle and right are identical due to the strong similarity of the renderers and usage of pseudo-random number generators with fixed seeds.
make
See ./build
for the executables and ./out
directory for the test image output.
make doc
See ./doc
directory for the documentation.
./build/examples/<executable>
Where <executable>
is any of the provided executables.
Use --help
to see the respective usage.
The current image formats focus on ease on implementation and depend on netpbm.
- PPM (Protable PixelMap also known as PNM) dircrete netpbm format (similar to PNG, JPEG etc.)
- PFM (Protable FloatMap) floating point netpbm format (similar to HDR, RAW etc.)
To convert to the desired formats via the netpbm package. E.g.
pnmtopng $file.pnm > $file.png
pfmtopam $file.pfm > $file.pam
pamtopng $file.pam > $file.PNG
# ...
Or use imagemagick. E.g.
magick $file.pfm -gamma 1.0 -set gamma 1.0 $file.png
magick $file.pfm -gamma 1.0 -set gamma 1.0 $file.tiff
Proper exposure and color grading can be archived the same way as for images taken by real cameras. E.g. with darktable.
make doc
See doc/html/index.html
for the documentation.
Run
.auto_format
to automatically format the entire code base (requires clang-format
).
Add DEBUG=1
to make
. The executables will be placed in build/debug
instead.
Run
./profile
to get a profile (requires valgrind
(profiler) and kcachegrind
(show data)).
- Linux kernel v6.3+
- C++20
- C++ Boost v1.80+
- gcc v13.1+ or glang v15.0+
- make v4.4+
- doxygen v1.9+ (optional, documentation)
- netpbm v10.73+ (optional, image processing)
- imagemagick v7.1+ (optional, image processing)
- darktable v3.8+ (optional, image processing)
- ffmpeg v6.0+ (optional, video processing)
- clang-format v15.0+ (optional, development)
- clang-tidy v15.0+ (optional, development)
- valgrind v3.21+ (optional, debug & profiling)
- kcachegrind v23.04+ (optional. debug & profiling)
- The heavy usage of headers is intended for future use of c++ modules. Unfortunately, c++ modules are currently (Sep 2022) not widespread enough to be considered supported by all compilers.
mov_0-60.highq.mp4
mov_flat_0-60.highq.mp4
geometry | curved | flat |
---|---|---|
method | non-linear propagation | linear/conventional propagation |
file (commit ed4358e) | examples/swirl_triangles |
examples/triangles |
size (resolution_factor ) |
480x270 pixel (2 ) |
480x270 pixel (2 ) |
frames | 60 |
60 |
samples |
1000 |
1000 |
ray_depth |
500 |
500 |
ray_step_size |
0.1 |
- |
swirl_strength |
0.01 |
- |
wall time (AMD Ryzen 5 5600X) | 2.5days | 7min |
max. total ray segments | 3,888,000,000,000 | 3,888,000,000,000 |