SSJX.CO.UK
Content

Porting the Business Card Sized Ray Tracer to the D Programming Language

Introduction

This page details my porting of the Business Card Sized Ray Tracer to the D Programming Language. This started as 1337 byte obfuscated C++ program by Andrew Kensler that Fabien Sanglard deciphered. For more information, see Fabien Sanglard's website here:

Porting to the D Programming Language

Most of the changes were similar to those done for the Path Tracer, click here to visit that page!

Final Result

I changed the text from the original and C++ version...


This took 22,062ms to render...
(512 x 512 with 64 rays per pixel)

Download

To keep the download size small, this is provided as a 7zip archive. Archive includes the compiled exe and source.

Benchmarks

As with the Path Tracer, this program benefitted a lot from doing the pixel rendering in parallel. It was almost twice as quick suggesting that the load was evenly spread across my two cores:

Parallel Version : 22,062ms
Standard Version : 40,890ms

This version was compiled using the LDC D compiler as follows: ldc2 -O -i trace.d

Conclusions

A lot of the code for this was copied from the Path Tracer which saved a lot of time and again making use of the parallel foreach loop made a big difference to the speed of the program. The advantages of using D is that I have a program that is fast, memory safe and still easy to understand.

Created 16/02/24