Ray Tracing

A simple ray tracing engine based on Compute Shader.

Imagem de capa

Code : Github

Date : Spring 2018

Ray tracing is a basic rendering technique used for global illumination, which can highly improve the visual realism. It usually has better rendering quality but greater computational cost than scanline rendering methods like Satry Renderer.

The algorithm starts with the camera. Casting the ray from every pixel of eye plane, then set the color and reflect the ray if it cast on the shape. After a few iterations, stop reflecting.

The shape construction is based on signed distance function, which can define a primitive in a very simple way. Besides, the most code is in compute shader, so it’s amazingly 70fps. I tried to render more general polygon model such as a sphere, but it’s really slow with so many triangles needing intersection and light calculation.

I use the Schlick’s approximation to get the fresnel factor to render the reflective surface.

it’s the scene without spotlight.

Here are some document and source code links :

[1]Samllpt - 99 lines Global Illumination

[2]Raytracing Topics & Techniques

[3] unity-raytracer Github

[4] ray-tracing Github