[Haskell-cafe] Ray tracer

Dan Piponi dpiponi at gmail.com
Sun Jul 15 17:26:53 EDT 2007


On 7/14/07, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
> The "Haskell ray tracer" seems to be a pretty standard and widely-used
> example program. But has anybody ever seriously tried to make a
> "production-grade" implementation? (I.e., one that is user-friendly,
> efficient, and with lots of functionallity.)

I'm not very hopeful about writing a "production-grade" ray tracer
completely in Haskell. In my experience, "production-grade" rendering
is always banging up on the limit of how much RAM you have on your
machine. This is the worst case scenario for garbage collection and
you really need very explicit management of memory. (Or you could
write in very unidiomatic Haskell but I'm not sure that would buy you
anything over other languages.)

But I don't think that means there is no role for Haskell in
rendering. Examples of places I think Haskell could play a role are:
the shader language, procedural geometry generation, the scene
description language, and overall scripting of the render (because
"production-gared" renders are rarely a simple matter of having a 3D
scene description and rendering it). And using Haskell as a shader
language doesn't necessarily mean Haskell code runs at render time -
Haskell could spit out, say, C code (and/or Cg code).

BTW If you're interested in "production-grade" graphics, you shouldn't
limit yourself to ray tracing. Renderers such as Renderman and Mental
Ray ray trace, but they also both rasterise. Really you want both at
the same time.


More information about the Haskell-Cafe mailing list