post aRT - Another raytracer

Filed under Code, Downloads by Iain (7:50 pm, August 9th, 2007)

aRT (another Ray Tracer) is a little Windows raytracer in C++. Read on for more pics and full source download.

aRT - striplight

Raytracing is a beautifully elegant way to make an image and makes a lovely break from scanline rendering; although in these days of GPU shaders the distinctions are blurring. I’ve loved raytracers since using Imagine on the Amiga, and built this a couple of years ago. aRT is built in Dev-C++ and uses SDL to show a preview image as it renders. The emphasis here was prettiness, not performance.

Features supported:

  • Reflection, refraction - with Monte Carlo methods for reflective/refractive scatter (blurred reflections)
  • Diffuse and specular lighting
  • Monte Carlo methods for global illumination approximation (diffuse reflections)
  • Planes, spheres, triangles, .OBJ models (with normal generation)
  • Point/area lights - triangles and spheres can also be emitters
  • Versatile scene and material description format, reusable materials
  • Texture mapping (bilinear filtered)
  • Adaptive super-sampling

Over the years I’ve noticed that a given raytracer definately has a distinctive “look”, due to lighting model variations even across different implementations of the same famous papers. Although there’s nothing ground-breaking here I do love the look of the images aRT produces. Some of the scenes below are converted to aRT’s scene format from other raytracers just so I could compare the look.

Incidentally I haven’t ever seen a method of approximating global illumination as simple as this; it’s not as good as a full radiosity solution but it’s very easy to implement. See RayTracer::GlobalIllumination in RayTracer.cpp.

Time for pretties! All of these scenes are included with the source; scroll down for the download.

Refraction
Refraction

Global Illumination
Global Illumination approximation

Dragon
Object loading

Gloss
Gloss

Area Lights
Area lights

The Venus de Milo
Object loading

Just to note, the OBJ loading code isn’t mine; it was found on the net and massaged in. Although hackily integrated it’s nicely encapsulated and provides the raytracer with polygon soup. Alas, I have lost the source of the original loader. If you recognise it, please let me know so I can credit accordingly.

Download (730Kb Zip file - includes binary, example scenes, full source)

Note that you’ll need to install the SDL DevPak to compile; I used version 1.2.8 from Dev-C++’s built-in WebUpdate and it worked fine.

2 Comments »

  1. [...] was late, I was bored; so I married a heavily stripped-down version of aRT, my raytracer to a little text-mode rendering library I knocked [...]

    Pingback by c o l d c i t y » Realtime raytracing + ASCII rendering — Aug 28 2K07 @ 6:03 pm

  2. Ooops - By working on this more I’ve now rendered this version obsolete. It now has decent spatial partitioning and oodles more speed!

    I’ll clean the code up for release soon but I’m working on some other projects at the moment.. in the meantime the above download’s still there.

    Comment by Iain — Aug 31 2K07 @ 3:31 pm

Leave a comment

ruld rurd
© 2001-2008 Iain Craig RSS Feeds Entries | Comments