Personal tools

FieldTrip

From HaskellWiki

Revision as of 03:32, 13 July 2008 by AndyGill (Talk | contribs)

Jump to: navigation, search


Field Trip is a library for describing 3D scenes declaratively. It is intended as an open technology independent API for building animations as well as still life pictures. We also supply a bridge to use the OpenGL rendering engine, but other technologies are envisioned, for example a raytracing based renderer.

It is in active development by Conal Elliott and Andy Gill.

Contents

1 Architecture

The basic purpose of the core FieldTrip library is to allow a user build a 3D scene. The principal types are as follows.

data Geometry3</dt>
A abstract type describing a number of objects in 3D space. These objects can be scaled, rotated or translated in space, as well as grouped. </dd>

type Surf a = (a,a) -> (a,a,a)</dt>
Primitive Geometry3's are build from surfaces, which represented as a function from R2 to R3 - so this function maps every point on the (2D) surface onto a point in 3D. </dd>

Normal and Derivatives</dt>
One novel feature of FieldTrip is the automation of derivative computation. We represent our surfaces using (more text) .. This design allows us to perform functions over surfaces, adding ripples and other deformities.

</dd>

type ImageC = (Float,Float) -> Color</dt>
We represent all 2D images as straightforward functions from location (in 2D) to color (including an alpha component). We use bilinear interpolation to sample imported image data. Fonts are also supported via our ImageC idiom.

The standard way of creating basic Geometry3 uses all these architectural features, using Surf and ImageC to realize a Geometry3, as well as the derivative mechanism to compute normals for realistic lighting.

In FieldTrip we provide some basic shapes of surfaces (spheres, torus, cubes, etc) and many functions for manipulating surfaces, colors, etc.

We combine a Geometry3 with lights, fog, and other effects, as well as a camera location, and give this combination (the details are still in flux) to the renderer.

1.1 Other Features

There is a 2D analogue of Geometry3, called Geometry2.

2 FieldTrip for Animation using OpenGL

Our first renderer uses OpenGL. FieldTrip is intended to be efficient enough for real time image generation. We do not draw shadows or reflections when rendering, and inherit the OpenGL anti-aliasing policy.

Towards efficiency we have a dynamic accuracy graphics context internally, which uses less triangles when tessellating a surface when performance is needed. When finished this will allow us to automatically use less triangle for distance objects, for example.

We want our library to be usable in real time by FRP-based code, though FRP is by design completely orthogonal to FieldTrip.

3 The FieldTrip Universe

Field trip has a number of packages.

FieldTrip</td>
The basic library of combinators for building 3D scenes. </dd>

FieldTrip-OpenGL</td>
The library for rendering a scene in real time, using the OpenGL library. </dd>

FieldTrip-GLUT</td>
The library for opening a viewer into a FieldTrip OpenGL based scene. </dd>

FieldTrip-GLFW</td>
Same, for GLFW. </dd>

FieldTrip-OSX</td>
An alternative version of GLUT/GLFW that provides access the the OSX extensions, for example .mov file capture. </dd>

There will be more!