VBA Raytracer

Rendering in Microsoft Word Rendered in Microsoft Word using Visual Basic for Applications (VBA).

This was a project I did in my spare time during military service in 2009. I wanted to write a raytracer for a long time (like somehow many people). But since I had nothing available except Microsoft Word, I wrote this as a Visual Basic script. When the service was over, it supported phong shading, analytic spheres, planes and triangles, textures for triangles, adaptive anti-aliasing, diffuse refraction and reflections, and soft shadows.

Now, when I found it on my hard drive again after several years and wanted to run it, I no longer had Word available. But since OpenOffice also supports VBA, I was able to get it to work there after a few modifications. However, the performance was so miserable that I decided to implement it in C++ and Qt.


  • phong shading
  • spheres, planes, and triangles
  • refraction and reflections
  • soft shadows
  • adaptive anti-aliasing

Source Code

The C++/Qt Version: QtRaytracer.zip
The original Microsoft Word document: Raytracer.doc
The orginal Visual Basic source code: Source Code