A new beginning.

When I tried to start writing posts on Raytracing, the idea was to document my steps. The problem was, that when I started,  I’d already finished the project.

When I say finished the project, what I actually mean is ” I got too bored, stuck, or distracted to continue.”

I hadn’t planned the code out very well, and as I added new things I had to break old things, and it turned in to a stack of kludges built on kludges. It was kludges all the way down. It may as well have been held together with gaffa tape.

So I’m going to start again, and this time plan it a bit better, and I’m also switching languages. And I’ll post on my progress, because even though no one is reading this, I can still refer back to it.

In memory of this occasion, here are some snapshots of what I achieved. They’re not all very good, and some of them are downright weird.

Early code, with bad lighting and only one type of object. Orthographic camera.

Can’t remember what the hell happened here. Early plane intersection code, I think

A cock up, but an attractive one, as they go.

Plane intersection code still making things difficult.

Yeah. Not sure about this. Lighting problem? Plane seems to work though.

Plane intersection working, with some randomisation of the “up” vector,

Showing only the phong exponent of the scene.

Polygon intersection test. Weird bug if two polygons lie on the same plane.

Fixed bug. Can’t actually remember what it was.

With polygon intersection tests working ( or so I thought ), I turned my attention to loading an OBJ.

After a long struggle with weird bugs, ta-fucking-da. Also, transparency.

Rabbit model without any normals calculated.

Also, persitent shadow bugs. These eventually turned out to be the plane intersection code playing up. Again.No ordinary rabbit! Normals calculated.Glass onion.


So there we have it, a long line of bugs, and some pretty pictures.

The next version will have all kinds of cool optimisation! (I hope.)

What I want to achieve:

  • Faster OBJ loading
  • BVH tree for scene divisions. Should dramatically speed up rendering.
  • Distributed ray tracing:  soft shadows, depth of field, etc.
  • An easier to steer camera, and possibly some animation, to produce videos. Not in real time.
  • Photon mapping. This can be bolted on top, I think.
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *