Nav:  [home][ani][anivision] > [vmflight1]
 
← [What are these? Why?]

AniVision -- Making of "Flight along Vallis Marineris"

A description on how the film Flying along Vallis Marineris on Mars was created using AniVision, RendView, POVRay, mencoder and the GIMP focussing on the application of AniVision.

POVRay scene file

Okay, so first we need the POVRay scene file for the animation. I will not dump the complete scene file here, just the important part which contains the information used by AniVision:

// marsfly.pov (c) 2004 by Wolfgang WIESER
// Based on mars-iso.pov (c) 2003--2004 by Wolfgang WIESER.
//------------------------------------------------------------------------------
//@fileID=mainscene   // <-- for AniVision

// This is the planet Mars:
union {
    sphere {
        0, planet_radius+max_topo_height
        pigment  { ... }
    }
    ...
}

// This describes the camera for AniVision:
//@object(macro=POVCam,type="camera",append_raw="angle 40")
#macro POVCam()
// camera {   <-- added outside
    perspective
    
    right -1.33333333333*z
    rotate -30*z  // 0 -> look radial <0 -> look down to the surface
    
    //matrix ...  <-- automagically
    //angle ...  <-- via append_raw
// }  <-- added outside
#end

// For testing:
#ifndef(AniVision)
  camera { location <0,0,-1>*8*20 ... }
#end

Especially note the lines with the special comments beginning with //@. These are interpreted by AniVision when scanning the POV file.

AniVision animation file

Next, I wrote an animation description file for AniVision. AniVision offers a complete simple programming language, so I can use it to convert the flight coordinate control points measured on a cylindrical projection of the image map into cartesian representation of the spherical coordinates used for the cubic spline interpolation resembling the way of flight.

/*
 * marsfly.ani -- AniVision animation file for
 *                "Flight along Vallis Marineris on Mars".
 *
 * (c) 03/2004 by Wolfgang WIESER
 *
 */

const int duration=16;   // Duration of the animation in seconds

// Define the animation and give it a sample name ("TheAni"):
animation TheAni
{
    // There is one setting called "TheSet" and we wish to compose
    // the animation by this one setting using time 1 to 1+duration.
    TheSet(time=1..1+duration);
}

// And here we define that setting:
setting TheSet
{
    // Setting init function:
    TheSet()
    {
        // Scan "marsfly.pov" for available POVRay objects, etc:
        $pov(scan={"path/to/marsfly.pov"});
        
        // Create camera object. Everything else is done by its constructor.
        new Camera();
    }
}

const scalar M_PI=3.141592654;  // Uh, what's that? ;)

// This is a coordinate conversion function to map the coordinates measured
// on the sperically projected image map into real cartesian poistions:
vector[] cv_pts(vector<3> v[])
{
    vector rv[]=new vector[v.size];
    for(int i=0; i<v.size; i++)
    {
        scalar r=3.396000+v[i].x/1000;   // e3 km
        // First, convert into radians:
        scalar phi=2*M_PI*v[i].y/1440;
        scalar lat=M_PI/2*(360-v[i].z)/360;   // positive -> North
        
        rv[i] = r * <
            cos(lat)*cos(phi) ,
            sin(lat) ,
            cos(lat)*sin(phi) >;
    }
    return(rv);
}

// This is an AniVision object; it describes the camera we use:
object Camera
{
    Camera()
    {
        // Attach to "POVCam" in "marsfly.pov", see the comment
        // beginning with "//@@object(macro=POVCam,...)"
        $pov(attach="POVCam");
        
        scalar prim_height=250;
        
        // Describe object (camera) movement using %{ ... }
        %{
            move {
                pos = curve {
                    pos = cspline {
                        // Curve points: <height, x, y>
                        // height: height above sea level in km
                        // x,y: coordinates on surface measured on
                        //      1440x720 cylindrically projected map
                        pts = cv_pts( {
                            <prim_height, 974.9,385>,
                            <prim_height, 975,  385>,   // 995
                            <prim_height, 1028, 385>,
                            <prim_height, 1086, 386>,
                            <prim_height, 1151, 402>,
                            <prim_height, 1199, 413>,
                            <prim_height, 1248, 412>, // 1258
                            <prim_height, 1296, 392>,
                            <prim_height, 1328, 378> });
                        tvals="dist";
                    }
                    t=0..duration;
                    speed = constant {}
                }
                
                // Front vector is parallel to the speed vector:
                front = speed {}
                
                // Use simple gravity model with force center for up vector:
                up = gravity {
                    force_center=<0,0,0>;
                    accel_scale=1;
                }
            }
        };
        
        // Make sure the object lives long enough to survive the complete
        // animation:
        delay(100000);
    }
}

Okay, so now we have to run AniVision. This film was made with AniVision-0.3.5pre which does not accept any command line args besides the file, so I simply ran
anivision ./marsfly.ani
to create 401 frames, f0000000.pov to f0000400.pov.

Having it rendered using RendView

Now, we need to have these frames rendered. As that takes quite long, on may do that on several boxes in parallel; I will only use local rendering on a single box below but the actual film was rendered on using over 20 LDR clients parallel connected to one LDR server (RendView implements both the LDR client and server).
I used a Makefile to launch RendView and the other tools:

# Makefile for make(1). By Wolfgang Wieser 03/2004.

all: frames rendview encode play

frames: xFORCE
    @cd ani/ && ../anivision ../marsfly.ani

RVARGS=
rendview: xFORCE
    rendview -rdfile=renderers.par \
        -l-rd=povray3.5M -l-r-args+="+L. +SP8 +EP8 -display :0.0" \
        -l-r-ifpattern=ani/f%07d.pov -l-r-ofpattern=png/f%07d \
        -l-rcont -l-cont -ld-r-nice=15

encode: xFORCE
    mencoder -mf w=640:h=480:fps=25:type=png -ovc lavc \
	-lavcopts vcodec=mpeg4:vbitrate=1200 -o ./flight.avi mf://png/"?0000*.png"

MPARGS=
play: xFORCE
    mplayer -vo xv ./flight.avi -loop 0

clean: xFORCE
    rm -f png/*.png ani/f*.pov

xFORCE:

Creating the film

Creating the title page was fairly easy: I used the GIMP and played around a bit until I was satisfied with the image. I saved it as title.png and created 75 symlinks from a0000000.png...a0000074 to title.png so that mencoder will include the title image as the first 75 frames.

Finally, I encoded the film using mencoder; see the Makefile above.


[home] [site map]
Valid HTML 4.01!
Copyright © 2003-2004 by Wolfgang Wieser
Last modified: 2004-06-27 17:02:05