Ray Tracing - Physics based Computer Graphics

A Physics based Renderer using Ray Tracing in C++.

Scroll ↓

Shaded sphere

A simple sphere

The goal of this project was to allow us to build a Ray Rracing rendering engine from scratch. The only part given to us was a function to export the final image.

I started by implementing a simple Sphere using Phong shading.

Simples hard shadows

Simple Hard shadows

I implemented proper shadow using bouncing rays.

Refraction showcase

Translucent spheres: Refraction

The next step was to implement refraction. The first sphere has a different refraction index. The leftmost one is very low, akin to a plastic ball. The middle one is medium, closer to water or glass. The right one is super high and would give result like diamond.

Mirror in the back

Mirrored plane: Reflection

Then we test reflection using a mirror in the background. This is also when the number of ray start to get rather important. So rendering time start to ramp up significantly.

Three sphere with absorbtion

Spheres with absorption

Sphere material using a physical based absorption formula. Here we can see that the closer to the center of the sphere we are the darker the result is.

Ray marching

Complex object rendered using Ray Marching

More complex objects are being rendered via a ray-marching method using formula from Inigo Quilez’s site. The advantage of this method compared to using polygon based models is that they are infinitely scalable while retaining perfect curvature.

Final render

This is the final render. It is 900x670px, using anti-aliasing techniques and it took me 8 hours to render on an Intel Core i7 3770K.