Editing Animation

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
[[category:tutorials]] [[category:animation| ]]
+
[[category:tutorials]]
 
The question often comes up about how to make an animation in BRL-CAD.  As BRL-CAD is primarily a solid modeling system for engineering and analysis purposes, there is (presently) only limited support for generating animations but it is possible with the assistance of some third-party tools.  The basic method is to make your model, decide what keyframes and sequencing you want to have in your movie, render those keyframes as images, and then composite them into an animation.  BRL-CAD can help will all but the last compositing step.   
 
The question often comes up about how to make an animation in BRL-CAD.  As BRL-CAD is primarily a solid modeling system for engineering and analysis purposes, there is (presently) only limited support for generating animations but it is possible with the assistance of some third-party tools.  The basic method is to make your model, decide what keyframes and sequencing you want to have in your movie, render those keyframes as images, and then composite them into an animation.  BRL-CAD can help will all but the last compositing step.   
  
Line 6: Line 6:
 
= Rendering image frames for an animation =
 
= Rendering image frames for an animation =
  
There are a variety of rendering and image processing tools that support a wide range of visualization techniques.  Tools that may be of interest include '''[[rt]]''', '''[[rtedge]]''', '''rtxray''', '''pixmatte''', and '''pixblend''' as well as a variety of other rendering and image processing tools.
+
There are a variety of rendering and image processing tools that support a wide range of visualization techniques.  Tools that may be of interest include '''rt''', '''rtedge''', '''rtxray''', '''pixmatte''', and '''pixblend''' as well as a variety of other rendering and image processing tools.
  
If the animation you want is very simple like having an animation of something spinning, the relatively simple process is described in the [[#Fly-around animation]] section.  If, however, what you want to animate is considerably more complex, there are a variety of tools that become important for setting up animation paths, managing keyframes, interpolating between frames, and previewing the animation.  There are animation tools in MGED (see the '''animmate'' command' (yes, it's actually spelled that way) for starters, the AnimMate Control Panel (under Tools), as well as a variety of animation table processing tools outside of MGED.
+
If the animation you want is very simple like having an animation of something spinning, the relatively simple process is described in the [[#Fly-around animation]] section.  If, however, what you want to animate is considerably more complex, there are a variety of tools that become important for setting up animation paths, managing keyframes, interpolating between frames, and previewing the animation.  There are animation tools in MGED (see the '''animmate''' command for starters) as well as a variety of animation table processing tools outside of MGED.
  
 
== Detailed arbitrary path animation ==
 
== Detailed arbitrary path animation ==
Line 20: Line 20:
 
  #!/bin/sh
 
  #!/bin/sh
 
  for i in `loop 000 359 10` ; do  
 
  for i in `loop 000 359 10` ; do  
  rt -a $i -e 35 -w 640 -n 480 -o image$i.png database.g top_level_object  
+
  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
 
  done
  
This renders 36 images of the object top_level_object from a geometry database that was named '''database.g''', creating images every 10 degrees (azimuth) at an elevation of 35 degrees.  The images are named ''image000.png'' through ''image350.png''.
+
This renders 36 images of the object top_level_object from a geometry database that was named '''database.g''', creating images every 10 degrees (azimuth) at an elevation of 35 degrees.  The images are named ''image000.pix'' through ''image350.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 the next number each pass through the for loop.  You can see the expansion by running the loop command directly:
 
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 the next number each pass through the for loop.  You can see the expansion by running the loop command directly:
  
  [sean@bz (Fri Feb 13 11:23:07) ~]$ loop 000 359 10
+
  [sean@bz (Fri Feb 13 11:23:07) ~]$ loop 000 259 10
 
  000
 
  000
 
  010
 
  010
Line 34: Line 36:
 
  350
 
  350
  
The third line calls '''rt''' to render an image.  The '''-a''' option sets the azimuth value and the '''-e''' option sets the elevation value.  The '''-w''' and '''-n''' options set the width and height of the image respectively.  The '''-o''' option specifies the filename for the output image that is generated.  Finally, there is the name of the database to read from and the name of the object in that database that we want to render.  The object is automatically centered in the view.Please make sure that the commands '''loop''' and '''rt''' are in the your search PATH using the linux '''export''' command.
+
The third line calls '''rt''' to render an image.  The '''-a''' option sets the azimuth value and the '''-e''' option sets the elevation value.  The '''-w''' and '''-n''' options set the width and height of the image respectively.  The '''-o''' option specifies the filename for the output image that is generated.  Finally, there is the name of the database to read from and the name of the object in that database that we want to render.  The object is automatically centered in the view.
 +
 
 +
The fourth line converts the .pix file to a .png file.  This is often useful/necessary because .pix files are raw first quadrant image files that aren't as prevalently supported as the PNG file format.
 +
 
 +
The fifth line deletes the pix file (since we have the png file now anyway).
  
 
= Compositing an animation =
 
= Compositing an animation =
Line 52: Line 58:
 
== With ffmpeg ==
 
== With ffmpeg ==
  
A simple way to convert an image sequence to a mpeg movie is :
+
To be written.
 
 
ffmpeg -f image2 -i image%d.png video.mpg
 
 
 
[http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs More information here]
 
  
 
== With Photoshop ==
 
== With Photoshop ==

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)