The cool thing…

… about working at a company where the previous programmers were, let’s say, inexperienced, is that the new programmer (referring to your’s truly of course) gets to pull magic white rabbits out of hats every day. And people do not cease to be amazed by it.

“When can you have the data for me?”
“I don’t know exactly, but it’ll take some time, because I have to rerun all these other things. It might take a long time, sorry.”
“So I take it next week sometime…?”
“No, no, this afternoon, or at least tonight”
“Oh wow you rock!”

The downside (and there is always a downside) is that the new programmer gets to inherit all the shitty code that his predecessors wrote.
I would put down a succinct example of said code, but frankly there is so much of it my mind is fragged.

peace out


hacking the plush

Via the Make Blog comes this video about a group of English girls who are introduced to the Arduino, and do some cool stuff with it.

Hold on, you say, given the concepts of

  1. microprocessor
  2. electronics,
  3. programming and
  4. young girls,

which is the odd one out?

However, the video shows the girls getting started, from scratch, with a basic introduction of what is possible with the Arduino, to developing an idea (or scenario, as they call it) which they would like to build themselves, to learning all the ins and outs of the construction, and in the end even getting to grips with programming, and ending up with a completed project!

For those of you who don’t know, the Arduino is a physical computing platform (which basically means a microprocessor that sits between your computer and an electronic circuit that you design). The magic of the platform lies in its low cost and the ease with which you can create interactive electronic projects ranging from the very simple to the amazingly complex.

This just goes to show how accessible electronics have become, and I hope we see more of this kind of thing in the future.

peace out

ray tracing is *hard*

I have forgotten how hard.

The first time I got wind of ray tracing in computer graphics was when I was scouring the shelves of a computer book store at the annual Computer Faire in Johannesburg. This must have been in something like 1992, or 93. The book in question was Photorealistic Ray Tracing in C, by Christopher Watkins, and it included the most amazing samples of images produced using ray tracing, it explained how it worked, and even included two 3.5″ floppy disks (we called ’em stiffies, go figure) with the example source code and everything.

Mind you, at that stage I was still wrapping my head around Pascal, and had null experience with C, so all I did was read, look and think.

So in the past week I started getting interested in building a ray tracer again, so I figured I’d start from scratch. It is not necessary to completely reinvent the wheel – thanks to the internet – because all the info is out there. The problem is that the only place where it is all available in one place is in the source code of the numerous open-source tracers. Many of them also have feature sets that go beyond mere ray tracing, and include things such as stochastic ray tracing, path tracing, photon mapping, bidirectional tracing, Monte-Carlo tracing and esoteric stuff like Metropolis Light Transport and radiosity.

All of which means that to implement the basics, one has to trawl through forums, dig around for papers, and use brute force trial and error. Here then, are some of my initial mistraces:

bug001 - Errors in sphere/ray intersection

bug001 - Errors in sphere/ray intersection

bug001 is a direct result of errors in sphere/ray intersection. Don’t know why it turned out so funky, but it did. It is a feature dammit, not a bug!

bug002 - Reflection works

bug002 - Reflection works

bug002 happened when I got reflection to work properly, with shadows. Not technically a bug. Let’s call it a work in progress.

bug004 - interesting twists

bug004 - interesting twists

This is definitely one of the buggier ones. Mostly because it appears as if I screwed up reflection here, you think. No, I was actually trying to implement refraction. Ha!

At the moment I have both reflection and refraction going, but I am rewriting some of the internals to make it more parallelizable. I also have plans to move port the tracing code to the GPU, via GLSL. Which will be hilarious, given my current dependence on printf-debugging just to make this simple code work…

Current features:

  • ortho and perspective camera models
  • two object types (sphere and plane)
  • one light model (point light source)
  • ambient, diffuse and specular surface
  • shadows (only ambient lighting)
  • reflections and refractions

Of course, I’d like to add all the other stuff too: one man’s feature creep is another man’s late night braingasm.

  • Other primitive types, including “discreet” types like polygons
  • Kd-tree implementation to speed up ray/primitive intersection
  • Anti-aliasing using one of the acceptable methods (more forum trawling/experimenting)
  • Procedural textures (keep your fork, there’s Perlin!)

peace out

Interactive Story Telling

Storytron, what a great idea. It’s like choose your own adventure on steroids.

I know, I know, they say it is not, but in a sense it is, just a finer grained version of it, without the action: “do you: pressure Saddam to give up” instead of “do you: stab the thief with the knife”…

It’s all very touchy feely, “levels” of “emotions” and “respect” (and other mushy nouns) going up and down the whole time. Very dynamic, very bold, and I think it is a great idea (said that already), great concept and it just might start a new subculture as big as IF.

I do however consider it a bit grandiose that they think they’ll capture the “women and men over 30″‘s market, which according to them is being ignored by most major game developers and companies. That assumption is true. But, fact is that specific market cannot give a good damn about computer games per se, it does not matter what guise the things take. The fact is simply that a lot of women and older men do not want to play computer games, since they don’t consider it fun and they won’t change their minds because you dress it up differently.

Your grandma, if she is still alive, will not put down her book and pick up the mouse to “play a game that is like a book” even if you paid her. She’ll continue reading her book. Or play with her Wii. Now those guys have figured out how to corner the older market, mainly because instead of sitting people down they have people stand up swing their arms. Not that I have to tell you that, but…

peace out.