Tuesday, May 20, 2008

Straight to the final

I must say I’ve come a long way over the course of one school year. When I started fall quarter I hadn’t the slightest clue how to work with OpenGL let alone set up a window that was running the API. I pushed myself hard. I made a working game with minimal knowledge, I’ve made an animation system, and I’ve even begun to understand the concepts around the OpenGL shading language. I don’t like to look at this project as a failure, but as a reflection on how much I’ve pushed myself.
I started working on this project as soon as I proposed it. When I decided on non-photorealistic rendering I knew I needed to get reading as soon as possible. I started research and reading the orange book. Before I knew it, the syntax and setup of the vertex and fragment shaders of OpenGLSL seemed very familiar to me. I made a lot of progress in little time.
It soon became apparent that writing the shaders was the easiest part of the process. Setting up the application around the system was by far one of the most frustrating problems I’ve dealt with. As I’m going to make clear in my presentation, one of the first problems I ran into was the loading of bitmaps. My previous experience with C++ has been great dealing with only text files and algorithms. However, working at a system level was somewhere I had yet to traverse. I searched for sample code and tried to covert it to work with OSX. Every time I booted something up, it either crashed or didn’t even compile.
I had to admit defeat with C++ and just find a working template to build upon. Time was running out. I started looking up the NeHe (Neon Helium) tutorials for a place to start. Their OSX conversions were built in Cocoa. I had tried to learn it during my animation algorithms class before, but I was unsuccessful after two weeks of studying it intensely. To get started this time, I did what I was most capable of doing. My first task was commenting the code I found. With the understanding I would piece together different blocks when I made progress. If I was to add anything, I would try to keep it in C code without breaking the program. What I got as a result was bitmap loading in one program, and shader loading in another. I had a working environment to do my proposed assignment, but by then, it was the day before it was due.
I had to make a choice. It seemed most proper to start building my presentation in case I worked through the night. With that done I stumbled across the gold mine. I had found the ARB code for the paper I wished to replicate. It was poorly commented and in a shading language I didn’t understand. Yet, I fought against the odds and tried deciphering it. Unfortunately, I fell short of the finish line.
What I did get done I consider easy. A toon shader is just… so simple when you grasp the concept. On one end, I’m ashamed that I had to settle with my backup. On the other hand I’m happy that I at least got that far. I’m pretty sure I hit upon every error possible while working on this project. I didn’t even have the latest version of the OpenGL framework!
All I can do now is look toward the summer. I’m going to spend more time working with OpenGLSL to replicate and expand the real-time hatching system. With just a little more development, it could give such a visceral effect running at real time speeds. Cheers to learning more.