Luminosity is a simple and elegant ray tracer written in Haskell.
Before compiling, get Luminosity's dependencies.
$ cabal install json --ghc-options=-DMAP_AS_DICT $ cabal install blaze-builder
--enable-documentation if you want their symbols to be linked when generating Luminosity's documentation.
If you already have JSON, make sure to
--reinstall with the
MAP_AS_DICT option, otherwise Luminosity won't compile.
$ cabal build
The executable will be located in
$ cabal install
This will install Luminosity to your user's local cabal directory.
$ cabal haddock --executables --hyperlink-source
--haddock-option=-ignore-all-exports to see documentation for all functions.
$ luminosity Scene.json Image.tga
You can leave out the second argument (in this case the image would be written to
Rather than introducing some custom format, Luminosity uses JSON to describe a scene. JSON is easy to read and there are many existing validation tools.
Of special note, all colours and vectors are specified as 3-element arrays. Colour channels are floating-point (0.0–1.0, not 0–255). The width (and aspect ratio) of the camera is dependant on the resolution in the settings, while the height remains constant. Use
ortho-scale to increase the size of an orthographic camera, and for perspective cameras, simply move it further back or adjust the
For now, the image output format is uncompressed TGA (Targa) for its simplicity. Soon, it will be PNG instead.
- JSON scene input
- TGA image output
- sRGB conversion
- orthographic and perspective projections
- sphere and plane primitives
- Lambert diffuse reflection
- ray traced reflection
- PNG image output
- parallel rendering
- faster rendering (optimized
- anti-aliasing (supersampling)
- exposure operator (rather than saturation)
- Blinn–Phong reflection
- transparency and refraction
- Fresnel effect
Surfaces (Cubes, Cones, Cylinders, Metaballs)
- directional light sources
- depth of field
- procedural and bitmap textures
- bump mapping
© 2012 Mitchell Kember
Luminosity is available under the MIT License; see LICENSE for details.