Realtime Raytracing - Part 3 (Lighting)

Written by Dean Edis on .

Welcome to the Gimpy Software article on creating a GPU-powered Raytracer! (Part 3)

In this next article we'll be extending our implementation to cover lighting.

As before, let’s start with the code. It gives us something to reference, and can be pasted directly into the shader editor for immediate results:

Realtime Raytracing - Part 2 (Adding Reflections and Animation)

Written by Dean Edis on .

Welcome to the Gimpy Software article on creating a GPU-powered Raytracer! (Part 2)

In this article we'll be extending our implementation to cover reflections and a simple animation. The former will add another level of realism, and the latter will help show the real-time nature of the rendering.

Let’s start with the code, which you can paste directly into the shader editor:

Realtime Raytracing - Part 1

Written by Dean Edis on .

Welcome to the Gimpy Software article on creating a GPU-powered Raytracer! (Part 1)

History
I've always been interested in computer graphics implementations. As a teenager in the 90s I used to watch 4Kb and 64Kb graphics demos and be amazed at the effects I saw, all being drawn in 'real time'. This prompted me to recreate some of the demo effects, and inspired my first experiments in 3D. In those days it meant hand-rolling my own assembly code to plot pixels, lines, polygons, etc - A very challenging, but rewarding learning experience!

As time moved on, and CPUs got more powerful, I developed an interest in ray tracing. I added a mental note onto my computing 'bucket list' of projects, but never seemed to have the time to implement my own.

Fast forward (quite!) a few years, and finally I achieved my goal - I wrote a simple ray tracer in C++. It gave good results, and the implementation was surprisingly simple. I was astounded at how little code was needed to achieve some visual output, and then again at how a few (relatively simple!) incremental tweaks to the ray tracing algorithm could result in significant improvements in the rendered scene.

I'm now going to revisit this project again, but this time using a GLSL pixel shader - Allowing REAL-TIME ray tracing - Something I couldn't event contemplate before. Instead of your CPU doing the image processing, a pixel shader allows your GPU to do it instead, and in a very ‘parallel’ fasion. To keep the development cycle as fast as possible I will use an online pixel shader editor:
http://pixelshaders.com/editor/

This compiles the code 'as you type' which makes seeing the results of your changes immediate - I totally recommend the site.