<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>GRASS Tutorial for nviz</title> <link rel="stylesheet" href="grassdocs.css" type="text/css"> </head> <body bgcolor="#FFFFFF" link="#0000DF" vlink="#006000"> <img src="grass_logo.png"><hr align=center size=6 noshade> <h1>NVIZ Reference Manual</h1> <hr width="100%" align=center size=4 noshade> <p> <a href="nviz_toc.html">CONTENTS</a> </p> <h2>Keyframe Animation Panel</h2> <p>The <strong>Keyframe Animation</strong> panel lets you create complex animations where you need precise camera control. Each keyframe that you set has nine <em>channels</em>, and each <em>channel</em> represents a part of the current view. For example, the <em>Field of View</em> (FOV) is a separate channel in each keyframe. <p> The <em><a href="../d.nviz.html">d.nviz</a></em> GRASS module may be used to automatically create Keyframe animation templates which can be loaded by this panel. <BR><BR> <DL><DD> <img src="nvimg/panel/keyanim.gif" alt="Keyframe Animation Panel" width="355" height="436"> </DD></DL> <BR><BR> <h3>OPTIONS</h3> <dl> <dt><img src="nvimg/panel/anim2.gif" alt="Play Reverse" width="16" height="16"> (Reverse Play)</dt> <dd>Plays the animation backwards. <br><br></dd> <dt><img src="nvimg/panel/anim1.gif" alt="Step Back" width="16" height="16"> (Reverse)</dt> <dd>Moves backward through the animation one frame at a time. <br><br></dd> <dt><img src="nvimg/panel/anim5.gif" alt="Stop" width="16" height="16"> (Stop)</dt> <dd>Stops the animation. <br><br></dd> <dt><img src="nvimg/panel/anim3.gif" alt="Step Forward" width="16" height="16"> (Forward)</dt> <dd>Moves forward through the animation one frame at a time. <br><br></dd> <dt><img src="nvimg/panel/anim4.gif" alt="Play" width="16" height="16"> (Play)</dt> <dd>Plays the animation. <br><br></dd> <dt> <strong>Framerate</strong></dt> <dd>Sets the framerate (frames per second) for the animation. <br><br></dd> <dt> <strong>Keyframe Attributes</strong></dt> <dd>The <strong>Keyframe Attributes</strong> scrollbar on the left moves through the nine channels of each keyframe. The bottom scrollbar moves through the user defined keyframes in time. A thick vertical blue line marks the current position (frame) in the animation. The current key time appears below this line in black. A light blue rectangle indicates selected channels for each keyframe. The key time of each keyframe appears vertically below each keyframe in light blue text. <br> To change your current position (frame) in the animation, click or click and drag the thick vertical blue line in the channels area. <br> To change the position (in time) of a keyframe, click and drag the vertical light blue key time text. To select a keyframe (or multiple keyframes) for deletion, middle-click the vertical light blue key time. The key times of selected keyframes will turn black. <br><br><br> <img src="nvimg/panel/keyexample.png" alt="Keyframe Attributes"> <br><br></dd> <dt> <strong>Channels</strong></dt> <dd>Each keyframe has nine channels that you can either turn on or off. The default for all channels is on. You need to set your channel options before adding a keyframe. <br><br></dd> <dd> <dl> <dt> <strong>FromX</strong></dt> <dd>Records the X coordinate of the camera (if selected). <br><br></dd> <dt> <strong>FromY</strong></dt> <dd>Records the Y coordinate of the camera (if selected). <br><br></dd> <dt> <strong>FromZ</strong></dt> <dd>Records the Z coordinate of the camera (if selected). <br><br></dd> <dt> <strong>DirX</strong></dt> <dd>Records the X coordinate of the center of view (if selected). <br><br></dd> <dt> <strong>DirY</strong></dt> <dd>Records the Y coordinate of the center of view (if selected). <br><br></dd> <dt> <strong>DirZ</strong></dt> <dd>Records the Z coordinate of the center of view (if selected). <br><br></dd> <dt> <strong>FOV</strong></dt> <dd>Records the Field of View (if selected). <br><br></dd> <dt> <strong>TWIST</strong></dt> <dd>Records the twist of the camera (if selected). <br><br></dd> <dt> <strong>cplane-0</strong></dt> <dd>Records the current position of the cutting plane (if selected). <br><br></dd> </dl> </dd> <dt> <strong>Add</strong></dt> <dd>Adds a key frame at the current <strong>New Key Time</strong>. The keyframe will store the selected channel information of the currently held view (camera angle, camera distance, height, twist, etc.). A keyframe's view attributes can not be directly modified after creation. If you wish to slightly alter the view at a key time, you will need to create a new keyframe at a nearby key time, delete the old keyframe, then move the new keyframe into the old keyframe's key time slot. <!-- note to "A"-type personalities reading this html source: It is also possible to edit a <strong>Save</strong>d keyframe animation project in a text editor if you need to make a minor adjustment. --> The <strong>New Key Time</strong> automatically increments by 3 seconds after each keyframe is added. <br><br></dd> <dt> <strong>Delete</strong></dt> <dd>Deletes all selected keyframes from the animation. You select keyframes from the <strong>Keyframe Attributes</strong> window by middle-clicking on the light blue vertical key time text. Selected key times will be shown in black. Deleted keyframes are not recoverable. <br><br></dd> <dt> <strong>New Key Time</strong></dt> <dd>Allows you to set a new key time. You enter key times as minutes, seconds, and frame number. Each time you add a keyframe, the key time automatically increments by 3 seconds. To calculate the length of the animation (in frames), use this formula <tt>(minutes*60 + seconds)*frame rate + frame number</tt>. <br><br></dd> <dt> <strong>Show Feature</strong></dt> <dd>Use these options to enable annotations on the animation. <br><br></dd> <dd> <dl> <dt> <strong>Path</strong></dt> <dd>Shows the path that the animation follows between key frames (if selected). This is useful for adjusting the tension if using a spline interpolation. <br><br></dd> <dt> <strong>Vect</strong></dt> <dd>Draws all loaded vector maps in the animation (if selected). <br><br></dd> <dt> <strong>Sites</strong></dt> <dd>Draws all loaded sites files in the animation (if selected). <br><br></dd> <dt> <strong>Volume</strong></dt> <dd>Draws all loaded 3D volumes in the animation (if selected). <br><br></dd> <dt> <strong>Labels/Legend</strong></dt> <dd>Draws all labels and legends in the animation (if selected). <br><br></dd> </dl> </dd> <dt> <strong>Interp.</strong></dt> <dd>Sets the interpolation used between key frames. <br><br></dd> <dd> <dl> <dt> <strong>Linear</strong></dt> <dd>Uses a linear interpolation between key frames. <br><br></dd> <dt> <strong>Spline</strong></dt> <dd>Uses a spline interpolation between key frames at the selected tension. <br><br></dd> <dt> <strong>Tension</strong></dt> <dd>Sets the tension of the spline interpolation. <br><br></dd> </dl> </dd> <dt>Animation: <strong>Run and Save</strong></dt> <dd>Runs the animation and saves each frame as an image. You must supply a file name prefix, frame start number, image type, and draw type. The image file name includes the file prefix, frame number and image type. For example, frame number 12 with a file prefix of FLY saved as a PPM would be named FLY0012.ppm. You can choose to render the animation off-screen (in memory). To render off-screen, you need to minimize the <strong>NVIZ</strong> viewer. <br><br></dd> <dt> <strong>File:</strong></dt> <dd> <dl> <dt> <strong>Save</strong></dt> <dd>Saves the keyframes attributes to a user defined file. <br><br></dd> <dt> <strong>Load</strong></dt> <dd>Loads a previously saved keyframe animation file. <br><br></dd> </dl> </dd> <dt><strong>Close</strong></dt> <dd>Closes the <strong>KeyFrame Animation</strong> panel.<br><br></dd> </dl> <H3>EXAMPLE</H3> Open the <a href="nviz_panel_surf.html">Surface panel</a> (<em>Panel->Surface</em> in the menu) and set the "Fine" polygon resolution to 2. (set to 1 if you don't get display artifacts) <p> Many encoder codecs require that the input frame size be divisible by 16. Set this in <em>File->Set Canvas Size</em>. (e.g. 512x512) <p> Change back to the keyframe animation panel (<em>Panel->Keyframe</em> animation in the menu). <P> Set first view, click [Add].<br> Set [New key time] to 0:02:00, change view, click [Add].<br> Set [New key time] to 0:04:00, change view, click [Add].<br> etc. <p> Rewind & press the play button to preview. <p> If you output to individual frame images (e.g. PPM) you will need to do the encoding step on your own. See the relevant documentation that comes with your encoder. For example: <br> <!-- adapted from a post by Maris N. on the grass mailing list --> <div class="code"><pre> ###### Pick a codec ###### ## DivX - libavcodec MPEG 4 (DivX5) OVC="-ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=1800" ## XviD OVC="-ovc xvid -xvidencopts bitrate=1024" ## DivX4 OVC="-ovc divx4 -divx4opts q=5" ###### ## Encode all .png files in directory to out.avi with 15 frames per second. mencoder "mf://*.png" -mf fps=15 -o out.avi $OVC </pre></div> <P> Alternatively, NVIZ can encode to a MPEG-1 movie automatically. (simpler, but lower quality)<BR> <i>Assuming NVIZ was built with FFMPEG support for live MPEG rendering:</i> <BR><BR> Next click "Animation: [Run and Save]", type in a basename.mpg, click the "<> MPEG-1 button", click the "<> Full Rendering" button, click [Ok]. <p> whiz-bang-whirl.<BR> Done. </P> </body> </html>