Why I wrote a Ray Tracer this weekend

“The game is to keep learning, and you gotta like the learning process.  I don’t think people are going to keep learning who don’t like the learning process.  And if you don’t keep learning, other people will pass you by. Temperament alone won’t do it – you need a lot of curiosity for a long, long time. "  - Charlie Munger 
Since my wife joined the law firm of Munger, Tolles and Olsen, I've become infatuated with Charlie Munger.  He's the mostly unsung hero of Berkshire Hathaway and Warren Buffett's long time partner.  Munger has a few great books out there filled with his wisdom, and one of his strongest encouragements is to keep looking for new things to learn.

My excuse is that I don't have enough time.  Between having a family, a full time job, and trying to keep up with the few friends I still can, I don't have the time to try as many new things as I'd like.  But that's an excuse, and with all things that take time, it's never that you don't have enough, it's that you don't make enough. Life is a prioritization exercise, and you have to prioritize what matters.

Having seen Toy Story 3 come out, I started looking into how computer graphics have evolved.  MIT has a great resource having their entire curriculum online with the Open CourseWare initiative, so I started taking 6.837 Computer Graphics.  It's great, they have the lecture notes, and the problems sets, and the problem sets are coding problem sets where over several assignments you write a ray tracer.  It was a fantastic re-introduction to a lot of Linear Algebra that I'd forgotten, and honestly, a bunch of C++ that I'd forgotten.  Given I work at Microsoft now, I figured I'd use Visual Studio to develop it to make sure I'm up to speed on the tool chain that most of the people on my team are using.

I'm about 70% through the class, and here are a couple images I generated.  Hardly rocket science, or works of art, but pretty fun for me.  I also tried to distill what I'm taking away from this effort:

1. Charlie Munger talks about learning the key ideas in a discipline and applying that to problems you see elsewhere.  The more key ideas you have, the better off you are.  For example, evolution is a key idea in Biology, and being able to apply that competition and survival of the fittest to investing strategies makes you a much smarter investor.  In Computer Graphics, the key idea is to reverse the direction of light, and trace the rays from the viewer's eye, back through the scene to the light source.  That touches on a 2nd favorite theme of Munger's, "Invert, always Invert".

2. It's been years since writing code was my full time job, and I find the further I get from it, the harder it gets for me to fully grasp the time required for each phase of the process.  Digging back in and writing code, and having to crawl through the debugger to find a simple math mistake is a refresher that every manager of software developers should take at least once a year.

A couple crappy looking rabbits, but I'm pretty proud of them.  I'd post the source to my ray tracer, but I figure I'll leave the MIT students to copy their homework from somewhere else.  I'm happy to send it to anyone who contacts me.