A vanilla ray tracer implemented in C/C++.
Reference: Ray Tracing in One Weekend
From wikipedia:
P3
# "P3" means this is a RGB color image in ASCII
# "3 2" is the width and height of the image in pixels
# "255" is the maximum value for each color
# This, up through the "255" line below are the header.
# Everything after that is the image data: RGB triplets.
# In order: red, green, blue, yellow, white, and black.
3 2
255
255 0 0
0 255 0
0 0 255
255 255 0
255 255 255
0 0 0
g++ ppm_example.cpp -o ppm_example
./ppm_example > sample.ppmThe generated image (converted to PNG):
Use ffmpeg:
ffmpeg -i input.ppm output.pngOr, use ImageMagick:
convert input.ppm output.pngg++ background.cpp -o bg_gen -std=c++11
./bg_gen > background.ppm
convert background.ppm background.pngThe generated background:
git clone https://github.com/Fyy10/ray-tracer.git
cd ray-tracer/
make./main > pic.ppm
convert pic.ppm pic.pngThe rendered image:
The code runs extremely slow (takes around 18 hours to produce a single 1200x800 image on my linux server with an Intel Core i3-530 CPU). GPU acceleration is important (not implemented yet).
make clean- 3D Vectors, 3D Points, Color
- Rays, Basic Camera, and Background
- Sphere Objects
- Surface Normal
- Hit Table and Multiple Objects
- Antialiasing
- Materials
- Diffuse Material
- Metal
- Dielectrics
- Positionable Camera
- Defocus Blur
- Random Scene
- Parallel Acceleration for Rendering


