Ray Marching

Ray Marching is a simple but effective algorithm that exploits parallelism offered by the GPU. It is implemented inside of a shader which is then executed on the graphics card. It is basically a ray tracer, but ray marching is an approximative algorithm—it finds nearest intersection by moving in small steps to reach a surface. One good thing is that shadows are almost free. All we have to do is march a ray from the point on the surface to a light and check if we can reach it.

This project is done for a Computer Graphics course on FER, Croatia. We had a liberty to choose a theme, and I chose this algorithm to improve my GLSL skills because I’ve never done much shader programming. What inspired me was this video.

The program is interactive—you can move the light by moving the mouse.

If you can read Croatian, here is a short documentation.

Here are some screenshots:

A simple scene.
A simple scene.
Infinite colored cubes.
Infinite colored cubes.
There are also other shapes, torus in this case.
There are also other shapes, torus in this case.
More complex shapes can be modelled too.
More complex shapes can be modelled too.

For more, visit my Github profile.

Back to projects