Difference between revisions of "FieldTrip"

From HaskellWiki
Jump to navigation Jump to search
(Overhauled / simplified)
Line 1: Line 1:
[[Category:Libraries]]
+
[[Category:Graphics]]
  +
[[Category:Packages]]
   
  +
== Abstract ==
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.
 
   
  +
'''FieldTrip''' is a library for functional 3D graphics.
It is in active development by Conal Elliott and Andy Gill.
 
  +
It is intended as an API for building static, animated, and interactive 3D geometry, efficient enough
  +
for real-time synthesis and display.
 
Our first renderer uses OpenGL, with the usual visual limitations.
  +
Since FieldTrip is functional, it is about ''being'' rather than ''doing''.
  +
One describes what models are, not how to render them.
   
  +
Besides this wiki page, here are more ways to find out about FieldTrip:
== Architecture ==
 
  +
* Read [http://code.haskell.org/FieldTrip/doc/html/ the library documentation].
  +
* Get the code repository: '''<tt>darcs get http://code.haskell.org/FieldTrip</tt>'''.
  +
* Install from [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/FieldTrip Hackage].
  +
* See the [[FieldTrip/Versions| version history]].
   
  +
Please leave comments at the [[Talk:FieldTrip|Talk page]].
The basic purpose of the core FieldTrip library is to allow a user build a 3D scene. The principal types are as follows.
 
   
  +
== Basic types ==
<dl>
 
<dt><b>data</b> Geometry3</dt>
 
<dd>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>
 
   
 
The basic purpose of the core FieldTrip library is to allow a user build 3D geometry, from individual simple shapes to full 3D scenes. The principal types are as follows.
<dt><b>type</b> Surf a = (a,a) -> (a,a,a)</dt>
 
<dd>
 
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>
 
   
  +
; <hask>Geometry3</hask>
<dt>Normal and Derivatives</dt>
 
  +
: 3D geometry. These values can be spatially transformed in space (affinely: scale, rotate, translate) and combined (union).
<dd>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.
 
   
 
; <hask>Surf a = (a,a) -> (a,a,a)</hask>
</dd>
 
  +
: Parametric surfaces, i.e., mappings from 2D to 3D. Normals are constructed automatically and exactly via derivatives, thanks to the [[vector-space]] library. These normals are used for shading. For simplicity and composability, ''surfaces are curved'', not faceted. Surface ''rendering'' tessellates adaptively, caching tessellations in an efficient, infinite data structure for efficient reuse. The mechanism for choosing tessellation is a very primitive placeholder. FieldTrip provides some basic shapes of surfaces (spheres, torus, cubes, etc) and many functions for manipulating surfaces, colors, etc.
   
  +
; <hask>Geometry2</hask>
<dt><b>type</b> ImageC = (Float,Float) -> Color</dt>
 
  +
: 2D geometry. There's a <hask>flatG</hask> function to embed 2D into 3D.
<dd>We represent all 2D images as straightforward functions from location (in 2D) to color (including an alpha component). We use [http://en.wikipedia.org/wiki/Bilinear_interpolation bilinear interpolation] to sample imported image data. Fonts are also supported via our ImageC idiom.
 
<dd>
 
   
  +
; <hask>Image o = (R,R) -> o</hask>
</dl>
 
  +
: A primitive placeholder for functional imagery in the spirit of [http://conal.net/Pan Pan]. The intention is to use this type or something like it for texture mapping. Much design and implementation work to be done.
   
  +
== FieldTrip meets Reactive ==
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.
 
   
  +
FieldTrip contains no support for animation, because we envision it being used with the [[Reactive]] [[FRP] (functional reactive programming) library (and possibly other animation frameworks).
In FieldTrip we provide some basic shapes of surfaces (spheres, torus, cubes, etc) and many functions for manipulating surfaces, colors, etc.
 
 
By design, FieldTrip is completely orthogonal to any formulation or implementation of FRP.
 
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.
 
 
=== Other Features ===
 
 
There is a 2D analogue of Geometry3, called Geometry2. Lines are drawn using Curve2, which are defined using
 
 
<b>type</b> Curve2 a = a -> (a,a)
 
 
 
 
== 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 fewer triangles when [http://en.wikipedia.org/wiki/Tessellation 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 FieldTrip is by design completely orthogonal to any implementation of FRP.
 
 
== The FieldTrip Universe ==
 
 
Field trip has a number of packages.
 
 
<dl>
 
<dt>FieldTrip</td>
 
<dd>The basic library of combinators for building 3D scenes.
 
</dd>
 
 
<dt>FieldTrip-OpenGL</td>
 
<dd>The library for rendering a scene in real time, using the OpenGL library.
 
</dd>
 
 
<dt>FieldTrip-GLUT</td>
 
<dd>The library for opening a viewer into a FieldTrip OpenGL based scene.
 
</dd>
 
 
<dt>FieldTrip-GLFW</td>
 
<dd> Same, for GLFW.
 
</dd>
 
 
<dt>FieldTrip-OSX</td>
 
<dd>An alternative version of GLUT/GLFW that provides access the the OSX extensions, for example .mov file capture.
 
</dd>
 
</dl>
 
 
There will be more!
 

Revision as of 18:26, 31 October 2008


Abstract

FieldTrip is a library for functional 3D graphics. It is intended as an API for building static, animated, and interactive 3D geometry, efficient enough for real-time synthesis and display. Our first renderer uses OpenGL, with the usual visual limitations. Since FieldTrip is functional, it is about being rather than doing. One describes what models are, not how to render them.

Besides this wiki page, here are more ways to find out about FieldTrip:

Please leave comments at the Talk page.

Basic types

The basic purpose of the core FieldTrip library is to allow a user build 3D geometry, from individual simple shapes to full 3D scenes. The principal types are as follows.

Geometry3
3D geometry. These values can be spatially transformed in space (affinely: scale, rotate, translate) and combined (union).
Surf a = (a,a) -> (a,a,a)
Parametric surfaces, i.e., mappings from 2D to 3D. Normals are constructed automatically and exactly via derivatives, thanks to the vector-space library. These normals are used for shading. For simplicity and composability, surfaces are curved, not faceted. Surface rendering tessellates adaptively, caching tessellations in an efficient, infinite data structure for efficient reuse. The mechanism for choosing tessellation is a very primitive placeholder. FieldTrip provides some basic shapes of surfaces (spheres, torus, cubes, etc) and many functions for manipulating surfaces, colors, etc.
Geometry2
2D geometry. There's a flatG function to embed 2D into 3D.
Image o = (R,R) -> o
A primitive placeholder for functional imagery in the spirit of Pan. The intention is to use this type or something like it for texture mapping. Much design and implementation work to be done.

FieldTrip meets Reactive

FieldTrip contains no support for animation, because we envision it being used with the Reactive [[FRP] (functional reactive programming) library (and possibly other animation frameworks). By design, FieldTrip is completely orthogonal to any formulation or implementation of FRP.