Personal tools

FieldTrip

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
m (FieldTrip for Animation using OpenGL: "less" --> "fewer")
(Overhauled / simplified)
Line 1: Line 1:
[[Category:Libraries]]
+
[[Category:Graphics]]
  +
[[Category:Packages]]
   
Field Trip is a library for describing 3D scenes declaratively. It is intended
+
== Abstract ==
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.
+
'''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.
   
== Architecture ==
+
Besides this wiki page, here are more ways to find out about FieldTrip:
  +
* 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]].
   
The basic purpose of the core FieldTrip library is to allow a user build a 3D scene. The principal types are as follows.
+
Please leave comments at the [[Talk:FieldTrip|Talk page]].
   
<dl>
+
== Basic types ==
<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>
 
   
<dt><b>type</b> Surf a = (a,a) -> (a,a,a)</dt>
+
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.
<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>
 
   
<dt>Normal and Derivatives</dt>
+
; <hask>Geometry3</hask>
<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.
+
: 3D geometry. These values can be spatially transformed in space (affinely: scale, rotate, translate) and combined (union).
   
</dd>
+
; <hask>Surf a = (a,a) -> (a,a,a)</hask>
  +
: 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.
   
<dt><b>type</b> ImageC = (Float,Float) -> Color</dt>
+
; <hask>Geometry2</hask>
<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.
+
: 2D geometry. There's a <hask>flatG</hask> function to embed 2D into 3D.
<dd>
 
   
</dl>
+
; <hask>Image o = (R,R) -> o</hask>
  +
: 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.
   
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 meets Reactive ==
   
In FieldTrip we provide some basic shapes of surfaces (spheres, torus, cubes, etc) and many functions for manipulating surfaces, colors, etc.
+
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.
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


1 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.

2 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.

3 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.