WarpRT


WarpRT is a simple, but effective, program that performs real-time warping and morphing using OpenGL texture mapping. It uses as input Mesh specification files directly output by Morphos, and Sun rasterfile images. It uses texture mapping to compute the two warped images, followed by a blending step, using alpha-blending. If 3D hardware is available, this process can easily be done in real-time.

  Download WarpRT (Win32, 0.25Mb) troubleshooting
  Browse Source Code  

Usage

WarpRT [-H] <from image> <to image> <from mesh> <to mesh>

<images>: images in Sun rasterfile format. Images must be square, with a power of 2 resolution.
<meshes>: specification output by Morphos (
wf format).
-H: show run-time commands

Although the input images have to be square and powers of 2, because of an OpenGL texture restriction, this does not imply that the output should be square as well, since the window can be resized on the fly. It is possible to simply scale up any image to a square and use it with the original meshes, which are automatically scaled.

Run-time commands

There are some keys that perform different actions while running WarpRT:

t: controls transformation mode: morph, source warp, destination warp
w:
toggles wireframe mesh
p:
controls animation cycling: pingpong/forward/backwards
space:
begin/stop animation playing
q:
quits
H:
this help

Source Code

The source files for the WarpRT program can be found here.

Creating Meshes

1. You can create meshes specification by hand in Morphos, by doing the following:

2. You also can create mesh specifications indirectly by using another form of specification to deform a mesh. In the resulting image, you can make the specification computed by the program visible and save it. The steps are as follows:

3. Another alternative is to use another program to procedurally create the meshes. The file format is very simple, and briefly described here. A sample can also be helpful. Note that the special tag #Mesh is followed by the number of columns and number of rows of the mesh. Rows of points of the mesh follow in order, from top to bottom (coordinates are normalized, with (0, 0) being top left).