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.

Share this post!

Bookmark and Share


azturkmusic said...

great ...
thanks for sharing
I always check your blog

Anonymous said...

For the 57th time in the trophy 63 year history St Stanislaus College secured the John O Shield on Saturday afternoon, a last ditch, 78th minute try from stand out winger Kang Kang sealing the Bathurst side enthralling 12 8 victory over traditional rivals Kinross. Played at Kinross Main Oval the Independent Sporting Association division one grudge match was full of swings and roundabouts, and the home side looked likely to claim their first derby win since 2013 as they led 8 7 heading into the final five minutes. They looked even more likely after Stannies five eighth Ben Mitchell missed a reasonably straight forward penalty goal attempt with just four minutes remaining. (tags: Coach Outlet Store Online , Michael Kors Bags Sale, Coach Outlet Store, MK Outlet)

There have been three named storms and one hurricane as of August 12. The average date of formation of the third named storm is August 13. One hurricane typically forms by August 10. The 5.0 liter V8 has 435 horsepower and 400 pound feet of torque, more than expected from a 5.0 liter. It's a great engine. The Mustang GT can shoot to 60 miles per hour in 4.5 seconds and reach 155 miles per hour. (tags: Jordan Shoes For Sale Cheap, 2020 Jordan Release Dates, Ray Ban Sunglasses Outlet)

For the second year in a row the Seahawks used the "franchise" designation on Jones. Hey, he held out last year, and didn't report until the season began. No reason to believe things will be any easier this year. When the ancient Polynesians invented surfing, they often used a paddle to help them navigate. Fast forward a few millennia, and Stand Up Paddleboarding, or SUP, finds itself trendy again. Part of its increasing popularity is that standing upright allows surfers to spot waves more easily and thus catch more of them, multiplying the fun factor (tags: Cheap Real Yeezys, Discount Jordan Shoes Wholesale, Cheap Yeezys).

caner said...


Post a Comment