Sunday, April 20, 2014

Writing a simple raytracer in Common Lisp

[Note: This is a repost after I accidentally deleted the original one].

Well, it's been a long time since I've last worked with Lisp and created the following stuff (~2008). Nevertheless I find it a waste to let all that stuff linger on some old URL that apparently neither I nor any other people have been using for ages.

So, if you've seen and read about the following tutorial on writing a simple raytracer in Common Lisp already, please forgive me for reposting it. If not, I hope you'll enjoy it and share with me the fun that I had during the creation of the material. Ok then, here goes what I have:

After stumbling upon Marco Baringer's and Rainer Joswig's Lisp related screencasts I realized how interesting, helpful and informative their contributions have been to me (thanks a lot!) and hence considered creating a comprehensive screencast/tutorial myself.

As I think that screencasts are a great idea to give someone a first insight into a particular topic and because (recently) on reddit there's been lots of discussions about Lisp being only for quantum physicists and the like, I eventually decided to create a tutorial on writing a simple raytracer in Common Lisp.

In my humble opinion, writing a raytracer shouldn't be too sophisticated for novices but allows for unveiling a reasonable amount of the programming language. And as far a the relatively easy mathematics and in particular the background of raytracing are concerned, I have included explanatory slides which will be thoroughly discussed during the tutorial.

Unfortunately I have only very limited time and hence couldn't finish each and everything that I would have liked to see in the tutorial. At the end of the provided screencasts, however, the raytracer is at a stage where basic raytracing and lighting do work.

As the creation of the screencasts and slides really was a lot of work and as I do not claim to be a Lisp uber-professional, I'd of course like to hear from you yet also ask you in advance to forgive me my (lispy) mistakes. The ones that I know about have been mentioned in the subsequent movie respectively. Also, please note that the first part is a neccessary prerequisite to its successors, yet the more interesting stuff starts from Part 2.

Topic Duration Size Related slides
Part 1 - Linear Algebra 1:10h 142 MB PDF
Part 2.1.0 - Basic Raytracing 1:28h 169 MB PDF
Part 2.1.1 - Basic Raytracing 1:09h 150 MB PDF
Part 2.1.2 - Basic Raytracing 1:54h 289 MB PDF

These two images show examples of what was rendered at the end of the above screencasts (click to enlarge).

The next images demonstrate more capabilities of the final raytracer. Unfortunately, whereas the code has obivously been written to the corresponding extent, I have never found the time to finish the screencasts and slides explaining the respective features as well as their implementation details.

Source Code

The source code is available at GitHub.

Tuesday, January 7, 2014

Introduction to Iteratees in Scala

It's a long time since I've last posted on this blog and this actually going to be a hands-on blog-post in its own right. Instead I'm just using the opportunity to direct you towards a set of slides and source-code corresponding to a talk on Iteratees that I gave at a Scala user group meeting in Munich on December 17th, 2013.
The meeting was hosted by the Sueddeutsche Zeitung and turned out to be really nice and comforting, both due to the location and of course the attending scalaphiles.
Heiko Seeberger started the evening with an insightful talk on akka and spray, including a live coding session demonstrating the "newly-weds" and their facilities for the easy development of a chat application. I also particularly liked the groll sbt plugin for navigating the history of the local git repository from inside sbt.