Difference between revisions of "Animation"

From BRL-CAD
(start the animation tutorial with the example that lee butler sent to the mailing list in march 2006)
(No difference)

Revision as of 11:09, 13 February 2009

With BRL-CAD and tools on the Mac it can be really easy to make a simple fly-around video of your BRL-CAD geometry. I've done this a couple of times now, and thought others might like to know how.

The BRL-CAD "rt" command has options for azimuth and elevation.

First render the images. You can create a shell script like this:

#!/bin/sh
for i in `loop 000 359 10` ; do 
	rt -a $i -e 35 -w 640 -n 480 -o image$i.pix database.g top_level_object 
	pix-png -w 640 -n 480 image$i.pix > image$i.png
	rm -f image$i.pix
done

This renders 35 images of the object top_level_object from the database called database.g. The images are named image000.pix through image355.pix


Walking through the shell script: The second line (for i in `loop 000 359 10` ; do) just sets up a loop to run with variable i set to: 000 010 020 ... 350

The third line calls rt to render. -a says "set azimuth to value..." and the -e says "set elevation to value..." The -w and -n options set the width and height of the image. The -o specifies the filename for the image. finally there is the name of the database, and the name of the object to be rendered. The object is automatically centered in the view.

The fourth line converts the .pix file to a .png. This is because iPhoto doesn't know how to read pix files (they are just raw data after all).

The fifth line deletes the pix file (since we have the png file now anyway).

That's the BRL-CAD part. Now for the Mac Magic.

Now open iPhoto and import the images (File->Import). To create the movie, select the images, and then choose File->Export. Select the "QuickTime" tab. You may wish to un-check the "Add currently selected music to movie" button. Now click the Export button. Type a filename and click "Save".

That's it. At this point you should have a quicktime movie of your geometry.