Tuesday, August 13, 2013

pb_ray: A Ray Tracer Based On pbrt

One of my projects on github is pb_ray. It's my implementation of pbrt from version 1 of Physically Based Rendering: From Theory to Implementation. I'm using version 1 since I can read that version of the book on Safari Books Online and version 2 isn't there at this point. I'd happily read version 2 but, compared to the price of the Safari Books Online subscription (free for me from my company), it's very expensive.

Edit: I checked Safari Books Online this morning and it looks like the 2nd Edition of Physically Based Rendering has shown up. Given that, I've just added it to my favorites list there and will start taking a look through it. Thanks guys!

I'm pretty sure that my version of the code is still in line with what Matt Phar and Greg Humphreys have since I checked in on their code base in github to get some clues for some specific questions, but it's great to see the second version of the book available.




As I've mentioned in a previous post, passion is necessary to a project to get it done in a reasonable amount of time. Which is exactly why this project is taking so long. It's become a playground for technologies that I want to learn at my leisure.

Here are some of the things I've focused on:
  1. Building in multiple environments.
    1. Why? Because I'm lazy and want to be able to use Macbook Pro on the couch when I don't want to be tied to my Windows desktop. The fact that anybody can pick it up and configure as needed with a single command is also a benefit.
    2. Because learning to use CMake may come in handy on a future project.
  2. Unit Testing
    1. While I can't follow TDD with this project to flesh out what the code is supposed to do since the book has broken down the tasks into code already, I hope for a couple things. First that, if there is anything in the code that could be written in a clearer, cleaner, more testable way I'll find it. And second that it might be useful to the actual PBRT project.
  3. Vi Plugins
    1. This project gave me an excuse to play with Syntastic.
    2. I will likely start taking a look at adding YouCompleteMe to my vimrc repository next.

Why did I pick ray tracing? Simply because it's interesting. It was one of my favorite projects in college.

Additionally, the idea of being able to take a piece of hardware and figure out how to harness its power then tax it to the limit in service of something productive has always interested me. Ray tracing is not only computationally expensive but generates a visually pleasing result (if your input is good, of course).

The idea of pushing hardware to its limits also encompasses finding out how far I can push those limits. It's a challenge to myself to find the biggest time consumer in the run of a program then to see if I can make that part run faster. (Ok, so I know that there are a TON of people who are way smarter than I am who are also doing this and getting paid for it, but it's an interesting challenge for me)

Lastly, I'd like to learn how to make the ray tracer runable on a GPU. This has been done before, of course, but I'd like to learn how it's done. Just from a quick Google search on the subject, here is NVIDIAs page showing their work on this subject and several different renderers using their work. Doing this falls under the idea of marshaling all of the available resources to name a project run more quickly. If there's a GPU sitting on the computer idle while the CPU is crunching away at something, it might as well be used to help.

No comments:

Post a Comment