Skip to content

jamesmcm/raytracer_challenge_scala

Repository files navigation

The Raytracer Challenge in Scala

The Raytracer Challenge book by Jamis Buck, implemented in Scala.

Scenes are read in a YAML format, as seen in the scenes directory.

The output is an image in the PPM format.

You can convert this to other formats using ImageMagick's convert utility, i.e.:

convert output.ppm output.png

Examples

Complex scene with model

Scala logo on table

Refraction test

Refraction test

Grouped shapes

Hexagon groups

Usage

Build:

sbt compile

Run:

sbt "run scenes/scene.yaml output.ppm"

Where scenes/scene.yaml is a YAML file describing the scene (see options below), and output.ppm is the output PPM file.

Run unit tests:

sbt test

YAML scene format

Scenes are described in a YAML format, as used in the book.

See examples in the scenes directory for usage.

Possible future work

  • Add the "define" statement to the YAML parser, so it can render all example YAML scenes
  • Add "group" statement to the YAML parser to allow for manual definition of groups within scenes (for bounding boxes)
  • Finish Constructive Solid Geometry chapter
  • Finish Texture Mapping bonus chapter
  • Add super-sampling option for anti-aliasing
  • Fix WartRemover Wart warnings
  • Add UV mapping to patterns (to correctly render surface patterns on spheres and cubes)
  • Add a Perlin noise pattern

About

Raytracer challenge book project implemented in Scala

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages