Luminosity
A simple and elegant ray tracer.
Install / Use
/learn @mk12/LuminosityREADME
Luminosity
Luminosity is a simple and elegant ray tracer written in Haskell.

Dependencies
Before compiling, get Luminosity's dependencies.
$ cabal install json --ghc-options=-DMAP_AS_DICT
$ cabal install blaze-builder
Add --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.
Compiling
$ cabal build
The executable will be located in dist/luminosity.
$ cabal install
This will install Luminosity to your user's local cabal directory.
Documentation
$ cabal haddock --executables --hyperlink-source
Add --haddock-option=-ignore-all-exports to see documentation for all functions.
Running
$ luminosity Scene.json Image.tga
You can leave out the second argument (in this case the image would be written to Scene.tga).
Scene input
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.
To learn how to write scenes for Luminosity, check out the Sample scene and the Parse module.
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 focal-length.
Image output
For now, the image output format is uncompressed TGA (Targa) for its simplicity. Soon, it will be PNG instead.
Features
Current features
- JSON scene input
- TGA image output
- sRGB conversion
- orthographic and perspective projections
- sphere and plane primitives
- Lambert diffuse reflection
- ray traced reflection
Planned features
- PNG image output
- parallel rendering
- faster rendering (optimized
Vector) - anti-aliasing (supersampling)
- exposure operator (rather than saturation)
- Blinn–Phong reflection
- transparency and refraction
- Fresnel effect
- more
Surfaces (Cubes, Cones, Cylinders, Metaballs) - directional light sources
- depth of field
- procedural and bitmap textures
- bump mapping
License
© 2012 Mitchell Kember
Luminosity is available under the MIT License; see LICENSE for details.
Related Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
