Skip to content
Evan Drumwright edited this page Mar 9, 2016 · 11 revisions

Moby simulations do not necessarily run in real-time or even run at a constant "frame rate" (this is generally true of all simulators: see our paper that describes this phenomenon further). Rendering movies from the simulation output is the most reliable way to visualize the simulation.

This documentation assumes that you are using Moby with OpenSceneGraph. The example below uses the example located in example/simple-contact/spinning-box-frictionless.xml.

First task: run the simulation

We run moby-driver using several options to generate output for rendering movies:

drum:/home/drum/Moby/example/simple-contact$ moby-driver -s=0.001 -v=10 -mt=10 -y=osg spinning-box-frictionless.xml 

The description of the options follows:

  • -s=0.001 I use a step size of 0.001 for this example
  • -v=10 This tells Moby to output every 10th scene from the simulation
  • -mt=10.0 Simulate the model for ten seconds
  • -y=osg Output the scene as an OpenSceneGraph file

The output will be a number of .osg (OpenSceneGraph) files in your directory.

Install ffmpeg

If you have not already done so, install ffmpeg. On recent versions of Ubuntu, you may find that ffmpeg has been replaced with the ffmpeg fork avconv (which is installed as part of the libav-tools package). Fortunately, the command line options in our rendering scripts work identically (for now) and you can setup a symbolic link to ffmpeg using the following command:

sudo ln -s /usr/bin/avconv /usr/bin/ffmpeg

Render the OpenSceneGraph files

For our example, we will use the simple movie rendering script that uses a fixed camera and fixed camera target:

drum:/home/drum/Moby/example/simple-contact$ render-movie-simple.sh 100 /usr/local/bin 0 0 10 . 0 0 0 spinning-box-frictionless.mp4 0 1 0

The options (the usage description of render_movie_simple is output if insufficient command line options are given) used follow:

  • 100 is the frame rate
  • /usr/local/bin is the path to the directory containing moby-render
  • 0 0 10 the camera position
  • . is the path to the directory containing the image
  • 0 0 0 the camera target
  • spinning-box-frictionless.mp4 the output filename
  • 0 1 0 is the camera 'up' vector

Wiki home

Clone this wiki locally