|
|
|
I spend most of my time at work programming. To many in the visual effects industry, being a programmer is a stepping stone to becoming a digital artist or taking on a managerial role. For me, it is a stepping stone to becoming a better programmer. Here's a brief overview of some programming languages I use: C/C++This is what I do most of my work with. The in-house renderer at Rhythm & Hues, as well as its many supporting libraries, are written in C++. I started programming in C back in my undergraduate days at U of T, and I started learning C++ shortly before I started at R&H. Though I am a big fan of C++ and prefer it over C, I am often frustrated by the fact that its implementation-hiding features like overloading and virtual functions make it a little too easy (even inviting) to forget what's going on behind the scenes; and that can make for inefficient code, especially when the code is shared among many programmers. Here's a sample program I wrote that calculates barycentric coordinates. This formula is important in rendering, particularly with ray tracing. Given a 3-D point that is coplanar with a triangle, the barycentric coordinates of the point with respect to the triangle indicate whether it lies within the triangle, and how close it is, in relative terms, to each of the triangle's vertices. Very useful for both intersection testing and interpolation.
PerlI picked up Perl about 5 years after
learning C++. I started
using it to automate various work-related tasks, such as multi-platform builds,
software releases, and CVS commits. As I learned more of this language, I began
to wonder how I ever got along without it. Although some have described Perl as an ugly language, I think it is extremely well designed and aesthetically pleasing. In some aspects of its design, I like Perl much better than C++. For instance, compare the implicit $_ in a foreach loop to C++'s rather ugly iterator construct for an STL container. Larry Wall wisely recognized that frequently used coding constructs, like iterating over a container, should not take dozens of keystrokes to use. Here is genuinely useful Perl program I wrote and posted to sourceforge.net: an RPN calculator that handles vectors of arbitrary dimensionality. You can mix an match vectors of different dimensions on the stack. Operators require compatible dimensions but allow reasonable combinations, e.g. vector times scalar. You can store results in variables, read and write the entire stack to a file, and even define your own (simple) functions.
1 2 3 This uses the built-in ang function, but we could have done the same using more basic operators as follows: 1 2 3
JavaI undertook an interesting coding project in Java back in grad school, just as I was finishing up my thesis. I came up with a technique for efficiently rendering an ellipsoid by computing its outline and then constructing a fan of triangles to fill the outline. Out of this came an applet I posted to my web page, which rendered a twirling ellipsoid using both this new technique and a standard polygonal wireframe. I was pleased to see that my technique accurately rendered the ellipsoid's silhouette using far fewer triangles. Unfortunately, I no longer have the source code for the applet, but I do still have the applet itself online at:
|