Glome

From HaskellWiki

About[edit]

Glome is a ray tracer written by Jim Snow. Originally it was written in Ocaml, but the more recent versions are written in Haskell.

Glome consists of the vector library GlomeVec, the ray tracing library GlomeTrace and an application called GlomeView.

GlomeView renders into an SDL window, and thus requires SDL. The ray tracing engine itself, though, has few dependencies.

(There is a deprecated package available on Hackage called glome-hs, which renders into an OpenGL window. It probably won't work with recent versions of GlomeTrace.)

If everything works, you should see an image something like this when you run Glome the first time:

(Testscene for early versions of Glome)

(Testscene for 0.3.1)

(Use +RTS -N4 or whatever if you want to use more than one core.)

Glome does not have a scene description language of its own (save for a rather rudimentary NFF parser), so the most convenient way to describe a scene is directly in Haskell. One can edit the file TestScene.hs included in GlomeView, then re-compile.

News[edit]

  • Oct 25, 2009: GlomeVec library released
  • Jan 20, 2010: GlomeTrace library released
  • Jan 22, 2010: New version of GlomeVec to (hopefully) fix GlomeTrace compile * failure
  • Jan 27, 2014: New version of GlomeVec, GlomeTrace, and GlomeView fixing several bugs that caused CSG to render incorrectly.
  • Apr 7, 2014: New version of GloveTrace and GlomeView. Major reorganization of textures, and now objects can be given arbitrary tags that are returned by the ray intersection test.

GlomeVec[edit]

GlomeVec is the vector library used by Glome. Originally, it was part of Glome, but now it is a separate library. It isn't implemented in any particularly clever way, but it has many useful routines for graphics built-in, like transformation matrices.

(GlomeVec is also used by a separate project, IcoGrid)

GlomeVec also includes a basic solid texture library. Right now, it has an implementation of perlin noise and a couple of simple textures like stripes.

GlomeTrace[edit]

GlomeTrace is a library that provides ray-tracing algorithms and a variety of geometry primitives. Originally, it was part of Glome, but now it is a stand-alone library.

Supported base primitives include: sphere, triangle, cone, cylinder, disc, plane, and box.

Composite primitives (those which are containers for other primitives) include groups, csg differenc and intersection, transformed instances, textured objects, and bounding objects.

In addition, there is an implementation of the BIH acceleration structure, which automatically builds a bounding volume hierarchy around unsorted lists of primitives. This greatly improves the performance for large scenes.

GlomeTrace depends on GlomeVec, but it doesn't have any other unusual dependencies.

Documentation[edit]

Features Lacking in Glome[edit]

This is a sort of to-do list

  • Antialiasing (update: it's available in version 0.3.1 on github)
  • Refraction
  • Photon mapping
  • PLY file parser
  • Rendering to a file
  • Support for portals (update: done)
  • Ability to tag objects and have ray intersection return the tag to tell you what you hit (update: done)

Questions[edit]

Send any questions to the author: jsnow@cs.pdx.edu In particular, I'd like to know if the test image is failing to render on you platform, or if it is failing to build.

Other Notable Renderers[edit]

These are some successful open-source ray tracers. They're worth looking at for anyone interested in writing their own.

  • POV-Ray - fairly slow, high-quality renderer with many features. This is the renderer that has had the most influence on the design of Glome.
  • Arauna - high performance renderer used for realtime games, faster than Glome by two or three orders of magnitude.
  • PBRT - topic of an excellent book on ray tracing.

Links[edit]