Modular Renderer

Download from You may also need the Generalised Bitmap Module.


The Modular Renderer is a set of C++ classes and functions, which provide a superset of the functionality previously found in the RT raytracer.

This means that now the full C++ language can be at your disposal to help build models for tracing and also for automating the generation of animations. It also opens the door to procedural textures and other advanced features.

Furthermore, MR provides other forms of rendering, such as wire-frame and polygon rendering, in order to provide fast previews etc..

It has the disadvantage that in order to perform raytracing, you have to write a program and compile it. Accordingly MR has a raytracer called RTMR, which is backwardly compatible with RT (my earlier raytracer) and implemented using MR.



It provides ray-tracer functionality based on information given in "Computer Graphics, Principles and Practice", by Foley, vanDam, Feiner and Hughes, and Byte magazine. It provides :-

Polygon rendering

Supporting (convex) polygon rendering, there are :-

Wire-frame rendering

Supporting wire-frame rendering, there are :-

Real time display

To support the real-time display of generated bitmap data are viewer classes which display a bitmap in a Windows window or XWindows window. There are limitations as to the quality of the display on non-24bpp displays. Error-diffusion to a small fixed palette may be employed.

Viewers have a refresh method, that when called make the screen match the contents of the bitmap data.

To help platforms which which a real-time display viewer does not exist, a viewer exists which is given a GBM filename template and an initial value. It will write a bitmap under that name and increment the value. eg: if passed frame%03d.tif,lzw and an initial value of 20, the refresh method will cause frame020.tif, frame021.tif, frame022.tif, .. etc. to be written (with LZW compression).

3D translations, scales and rotations

The classes representing (x,y,z) vector, colours, surfaces, shapes, viewpoints, polygon and wire-frame operations lists, all have methods allowing them to be translated, scaled and rotated in 3D space.


When compiling MR itself :-

When writing a program using MR :-

Compilers etc.

MR has recently been enhanced to handle quartics, such as torii. As a result it has to solve quartic equations and it currently uses an analytical approach, using complex numbers. The source is dependant on the standard <complex> header providing a full implementation of template complex<base_type>.

MR should compile fine any any modern ANSI / ISO standard C++ compiler.

On Linux I currently use Fedora 14, and g++.

On MacOSX, currently use Yosemite, XCode (which is clang based) and XQuartz.

On AIX, I use IBM xlC++ (aka Visual Age).

On SunOS, I expect I'd either use the SUNWspro CC, or g++.

On Windows, I use Visual Studio 2013, but with some tweaking of compiler versions, 2008 and 2005 should work.

I've compiled on Windows using mingw-w64 successfully also.

On OS/2, I use to use IBM VisualAge C/C++ 3.0, with CTC306, CTD302 and CTU304 fixes.

The UNIX makefile relys on GNU make.

Public domain declaration

I wrote all this code in my own time on my own equiptment. I hereby place all this code into the public domain. Feel free to do whatever you like with it. No copyright / no royalties / no guarantees / no problem. Caveat Emptor.

This documentation was written by the MR author, Andy Key