smallpt-hs: A Haskell port of the smallpt path tracer.

[ bsd3, graphics, program ] [ Propose Tags ]

A Haskell port of smallpt. smallpt is a global illumination path tracer written in 99 lines of C++. The Haskell port is also written in 99 lines. Please see the Homepage for more information, included easier to read code waiting for your contribution.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1
Dependencies base (>=4 && <5), vector (>=0.6 && <0.7) [details]
License BSD-3-Clause
Author Vo Minh Thu <noteed@gmail.com>
Maintainer Vo Minh Thu <noteed@gmail.com>
Category Graphics
Home page http://github.com/noteed/smallpt-hs
Source repo head: git clone git://github.com/noteed/smallpt-hs.git
Uploaded by VoMinhThu at 2010-09-08T21:22:06Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables smallpt-hs
Downloads 1129 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-12-29 [all 7 reports]

Readme for smallpt-hs-0.1

[back to package description]

smallpt-hs

This is a port of smallpt, a global illumination path tracer written in 99 lines of C++. The port is written in 99 lines of Haskell.

There are two major differences: performance and argument parsing. The Haskell code compiled with GHC 6.12.1 is about 4.5 times slower than the C++ version. (I only tested on my anemic Atom N450-powered netbook...) The C++ code takes an optional argument, which should be a integer greater than 4.

Give it a spin

This repository contains more than the 99 lines smallpt-hs.hs file. There are other variants with a criterion wrapper to benchmark the code. The cbits directory contains the original smallpt.cpp file modified to be expose the main entry point as a C symbol callable from Haskell via FFI.

Every attempt so far use the vector package. The 99 lines file is derived from Smallpt/Mutable.hs. The Storable code doesn't improve the performance and is less convenient to use. The Unboxed code lose in performance because the Vec type can't benefit from an explicit unpack pragma.

If you can make the code faster or easier to read, please let me know!

License

Although the LICENSE file is a BSD3 license, I should contact Kevin Beason (the original author of the C++ code) to make sure it is ok. The linked site above has the original LICENSE.