by károly zsolnai - email@example.com
this is a renderer program implementing the classic monte carlo path tracing global illumination algorithm. looking at the above picture you may not see what you would expect from a such a renderer: it has an interesting look which resembles the viewer of a painting (full size image). please meet smallpaint.
- implementation in ~250 effective lines of code,
- multi-threaded rendering thanks to the OpenMP library,
- some c++0x wizardry (ty CsL!),
- quasi-monte carlo sampling using low-discrepancy Halton series,
- cosine importance sampling,
- faster convergence through next event estimation,
- soft shadows, antialiasing by integrating over the screen pixels (path tracing approach),
- refractions, color bleeding, caustics,
- can be compiled into a binary with lesser than 4096 bytes,
- ...and most importantly: a great painterly look.
you can freely alter the scene description (or even build a new one) by adjusting the following attributes:
add(new Sphere(1.05, // radius Vec(1.45,-0.75,-4.4)), // position Vec(4,8,4), // color 0, // emission 2); // type (1=diff, 2=spec, 3=refr) add(new Plane(2.5, // position Vec(-1,0,0)), // normal Vec(6,4,6), // color 0, // emission 1); // type
you can compile the program using >=gcc-4.5.0 (or lower with the more compatible version at the downloads), and it has also been tried out in VS2010 with success, though it's built-in OpenMP library may have compatibility issues.
g++ smallpaint.cpp -O3 -std=gnu++0x -fopenmp ...or my personal preferred command line: g++ smallpaint.cpp -O3 -std=gnu++0x -ffast-math -msse -msse2 -msse3 -msse4 -Wall -Wextra -funroll-loops -static-libgcc -static-libstdc++ -fopenmp -fno-exceptions -fno-rtti -pedantic && a && ray.ppm