Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

ScalaRay - Ray tracer based on pbrt (see http://pbrt.org) written in Scala 2.8

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.mkd
Octocat-spinner-32 pom.xml
Octocat-spinner-32 run.bat
Octocat-spinner-32 run.sh
README.mkd

ScalaRay

This is ScalaRay, a ray tracer written in Scala 2.8. It is based on pbrt, the ray tracer described in the book Physically Based Rendering - From Theory to Implementation by Matt Pharr and Greg Humphreys, publisher: Morgan Kaufmann, ISBN: 0-12-553180-X; second edition ISBN: 978-0-12-375079-2

Note: The second edition of this book came out in July 2010. I initially based ScalaRay on the first edition, but I now also have the second edition and parts of ScalaRay are based on pbrt version 2.

pbrt is also available on github; see mmp/pbrt-v1 for pbrt version 1 (first edition of the book) and mmp/pbrt-v2 for pbrt version 2 (second edition of the book).

Background

I wrote ScalaRay because I wanted to learn the Scala programming language by doing a larger project. Note that ScalaRay is not intended to be production-quality software; it is an educational hobby project, it is not complete and not optimized for speed.

I've been interested in 3D computer graphics for a long time. I wrote my first ray tracing program in C on the Commodore Amiga, inspired by a German book (Amiga 3D-Grafik und Animation, by Axel Plenge, ISBN 3-89090-526-9). That was in 1988. I remember writing a ray tracer in Turbo Pascal a few years later on my first MS-DOS PC.

Prerequisites

To compile and run ScalaRay, you need:

After installing the JDK and Maven and adding their bin directories to your PATH, you can compile it with: mvn package

If you have compiled ScalaRay successfully, run it with: scala -cp target\classes org.jesperdj.scalaray.Main

TODOs

ScalaRay is not as complete as the original pbrt. Here is a list of things that need to be fixed, enhanced or implemented, in no particular order.

  • make it possible to sample area light sources with stratified sampling; not only with Latin hypercube sampling
  • is it worth it to have a mutable variant of class Spectrum? (call it SpectrumBuffer, for example; add implicit conversion SpectrumBuffer -> Spectrum)
  • implement accelerators (bounding volume hierarchy, kd-tree, grid)
  • implement triangle mesh, loop subdivision surface, height field
  • implement Sphere.sampleSurface
  • implement reflection models, materials, texture (see book chapters 9, 10, 11)
  • complete DirectLightingSurfaceIntegrator (reflection and refraction)
  • implement other samplers (see book chapter 7)
  • implement other light sources: texture projection light (13.2.2) goniometric diagram light (13.2.3), infinite area light (13.5)
  • implement output to EXR format (high dynamic range)
  • tone mapping (see book chapter 8, only in first edition)
  • implement other surface integrators
  • implement volume integrators
  • implement other cameras (see book chapter 6)
  • create unit tests (with ScalaTest)
  • profile, optimize speed (at the moment I haven't found a profiler which works well with Scala)
  • better concurrency
  • statistics
  • DSL for scene definition (use Scala's parser stuff)
  • add features that are not in pbrt (iso-surfaces ("blobs"), for example)
  • pbrt has no shadow ray caching; investigate if this is worth implementing
  • subsurface scattering
Something went wrong with that request. Please try again.