Monday, December 6, 2010

GPU Ray Tracing With GLSL

Tracing light rays from a virtual camera into a 3D scene
Ray tracing, at its core, is the process of tracing beams of light through some physical 3D space.  Light beams (or rays) typically travel in straight lines until they bump into some object.  At that point, the rays can either reflect off the surface, refract through it, or be absorbed by it.  Though the ray tracing technique can serve other purposes, it is generally used as a means of rendering photorealistic images.

One of the graphical features that are easy to obtain using ray tracing is physically accurate and pixel-perfect shadows.  As is apparent in the figure to the right, rendering a shadow is as simple as casting a ray from the surface of an object toward the center of a light source.  If that ray intersects some object before it reaches the light source, the originating surface point is in shadow.

Simple!

Ever since I was introduced to GLSL, I wondered if it would be feasible to implement ray tracing on the GPU.  The GPU, after all, is well-suited to geometrically-oriented computations.  I decided to take the opportunity to find out by attempting to implement it as a final project for Chuck Hansen's course on Interactive Computer Graphics at the University of Utah.  As a first pass, I decided to use ray tracing simply as a means of computing the shadows of an interactive OpenGL scene.

Read on for how I did it.

Monday, March 23, 2009

Good Intentions


Today I intended to create a Unit Test project for my primary project at work (SeboAPI).  It was going to be grand.  It's going to wait until another day.  The problem is I have too many bites to take before it can really be said to be a worthwhile portion of the whale that is the SeboAPI.  There are too many decisions to make and not enough motivation at this point.

What I did actually make progress on was resurrecting my old CruiseControl .NET server.  Righteous!

Tonight's FHE lesson was delivered by the ever-so-wiggly Mallory.  She taught us things we already knew about fish.

Tonight I skimmed the research pages of a few Computer Science departments to which I'm interested in applying.  In the process I came across a paper about a research project that intends to apply a native accent to a person's recorded speech of a foreign language.  It didn't take me long to get lost in all kinds of stuff I don't understand.  I feel good about giving it a shot, though.

My plan for tomorrow is to whittle down my list of FogBugz tasks at work to less than or equal to 2 (not counting the one I created for unit testing).  I also intend to attend a PhD student's presentation at BYU tomorrow afternoon.