Skip to content

s-tian/lux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lux

Lux is a work in progress tail-recursive raytracer written in Scheme. It is able to model diffuse, mirror, and glass spheres. It is partially based off of smallpt and uses techniques from the book Ray Tracing in One Weekend.

The 500x500 render below won 1st place in the heavyweight division of the Fall 2017 CS61A Scheme Art Contest at UC Berkeley. This project uses the CS61A implementation of Turtle graphics.

We started with a naive ray tracing implementation. Running the initial version of the program through a Python3 scheme interpreter, we rendered a 20x20 image of the Cornell box using 4 samples/pixel in around five minutes:

20x20 Cornell box

This is a 200x200 image of the same scene at 4 samples/pixel, rendered in ~7-8 hours:

200x200 Cornell box

It became apparent that rendering images at higher resolutions with less noise would take far too long. After exploring a few optimization options, we found that PyPy could run the Python interpreter at far greater efficiency. Using PyPy3, this 100x100 image of the Cornell box at 10 samples/pixel took around 25 minutes to render:

100x100 Cornell box

Here is a 300x300 image at 4 samples/pixel:

300x300 Cornell box

Finally, with adjusted colors, scene arrangement, and an additional diffuse surface, our 500x500 image at 500 samples/pixel:

500x500 Cornell box

About

Raytracer written in Scheme

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages