All the content in this section has been lifted from my old website; the stuff here is pretty ancient but I was always rather proud of it so I’ve dragged it up (and the images from a long forgotten directory) and but it back on my new site. One day I’ll come back to this project and carry on working on it (pah in my dreams!)
Introduction
A ray tracer is an image rendering tool, which can generate very realistic images. It does this by modeling the physical properties of light and produces its images by casting (or tracing) rays of light through a modeled scene, as they would behave in the real world and projecting the results into an image. It is a mathematically intensive process, however by the implicit nature of the core algorithm it handles reflections, shadows and refractive transparency very well, things which other algorithms (say a scan line, z-buffered polygon renderer) would struggle with.
It is worth noting the images below were generated solely with the ray tracer and the entire project was coded from the “ground up” even down to the vector and matrix math routines as I wanted to develop my own libraries to get a better understanding of the mathematics.
Source Code & Notes
Source code? I’m not sure if you really want to be downloading this. It hasn’t been too good for my sanity, so I’m certain it won’t be to good for anyone else’s! Here it is anyway, for simple reference more than anything.
The code is a bit of a mess, most of it has comments but some of it hasn’t; some bits make sense, some bits don’t, you get the general idea…
Basically I’m putting up it here for the curious and for anyone else writing a ray tracer. Bear in mind that since writing this (back in 2001 or so) I have learnt a lot about Java, so this code is a little immature shall we say.
The GUI currently does nothing, the scene is hard coded into the source and the textures code is fairly static. So a top list of stuff to do includes:
-
Refractive transparency – Done, but some objects don’t have ‘real’ interiors yet. Cylinders are real pain.
-
Proper camera parameterization – Done, but hard coded
-
Anti-aliasing – Done, adaptive & non-adaptive
-
More objects: Torus, Polygons, NURB surs, Superquadrics, Blobs etc.
-
CSG
-
Get the GUI doing good stuff, parser for scenes etc. (Use XML and JAXP)
-
Better procedural and image based texturing
-
Bump mapping and normal modification
-
Loads of optimizations needed, multithreading
-
Blah, blah, blah…





hi,
great little java ray tracer!
can u please tell me the license,?
is it FREE to use and modify commercial / non commercial?
thanks!
Great tracer! Just looking through the code – what are your shadow cases? Couldn’t figure out the variable names you wrote: N2X2, N3X3, N3X3W, and ADAPTIVE. What do these names mean / stand for? Thanks! Just trying to wrap my head around this stuff!
hi!
it’s great tracer and very easy to understand.
i will be waiting for updates espacialy parsing and image texturing stuff.
without them it’s not a fully raytracer i think.
antialiasing stuff is a bit complex.
thanks for sharing this useful code.