3D Scientific Visualization with Blender

Chapter 5

Animation

The output of a scientific visualization created with Blender can include 3D scatter plots, static images of a 3D scene, or 3D animations with or without supporting camera movements and tracking.

5.1 Keyframes

To facilitate the animation of a mesh object, the X, Y, Z position, rotation and scaling must be recorded in a keyframe. Keyframes are noted in the animation playback bar at the bottom of the GUI via yellow lines pertaining to the selected object. Keyframes are inserted via the I key—possible selections are shown and described in figure . Keyframes are deleted via the key combination ALT–I. An advantage of using keyframes is that Blender will automatically interpolate between frames—keyframes do not need to be set for every frame in the animation of a mesh object.

image

Figure 5.1. Pressing the I key allows the user to key an object, which inserts a keyframe recording a positional aspect of the object during a visualization.

5.1.1 Example: how to rotate and animate an object

The example below shows how to insert rotational keyframes to rotate a torus about the X-axis (colored red in the default 3D view space) and edit them with the Graph Editor so smooth motion can be created. The animation will be 300 frames at 30 frames per second for a total duration of 10 s. In those 10 s, the torus mesh will rotate 360 degrees (figure ).

image

Figure 5.2. The rotation is keyframed (in yellow) during the animation of a torus mesh object.

  • Set the number of end frames to 300 on the Animation toolbar at the bottom of the screen. Set the current frame to 1.
  • Create a torus mesh by clicking Add → Mesh → Torus. Alternatively, the keyboard shortcut SHIFT–A can be used.
  • Open the Transform toolbar (small plus sign +).
  • Keyframe the torus at 0° rotation (I key followed by ‘Rotation’ on the pop-up menu). Alternatively, the user can right-click on the rotation coordinates in the Transform toolbar and choose ‘Insert Keyframe’. A yellow vertical line will be placed on the Animation toolbar at the bottom of the window.
  • Move the green animation slider to frame 150.
  • Change the X-rotation value to 180 degrees in the Transform toolbar. Right-click on the value and insert another rotation keyframe.
  • Finally, move the green animation slider to frame 300, change the X-rotation value to 360 degrees and right-click and insert another keyframe.
  • Play the animation with the right pointing arrow play button on the Animation toolbar.

5.1.2 Example: using the graph editor

Note that the rotation of the torus ramps up in the early frames and then slows down at the end. If we want to cycle this animation to move smoothly, a constant speed is required. The Graph Editor can be used to adjust the rotation.

  • Open the Graph Editor (figure ) in the main window.
  • At the bottom of the Graph Editor window, select View → View All.
  • Press the V key and set the ‘Keyframe Handle Type’ to ‘Vector’.
  • Return to the 3D view port in the default view and replay the animation, which should run at a constant speed throughout the number of frame specified on the animation time line.

image

Figure 5.3. The Graph Editor allows the user to visually control the animation in Blender. By changing the shape of these curves a smooth animation during the visualization can be created.

5.1.3 Example: adding a cyclic modifier

Building on the previous example, we can have Blender automatically repeat the visualization by adding a cyclic modifier to the Graph Editor.

  • Click ‘Add Modifier’ on the right-hand side of the screen.
  • Choose ‘Cycles’. A saw tooth waveform will appear in the graph editor.
  • Figure shows the progression of how to add a cyclic modifier and what the final graph should look like.

image

Figure 5.4. These three panels show vectorizing the rotation about the X-axis (red curve), to which a cyclic modifier is added to repeat the animation.

The torus will now repeat keyframed motion for the duration of the video rendering, independent of the length.

5.2 Frame rates and rendering output

Rendering video will depend on hardware resources and the goals of the visualization. For broadcast quality HD output, the highest resolution and video codec should be used. For trial renderings during visualization development, lower resolutions without all the rendering elements can be utilized.

The stamp feature in the Render tab is useful for recording metadata about the visualization—frame rates, render times, authors and what scene components were used in the final composite.

5.2.1 Output formats

Single frame images can be exported in a number of formats. For high quality video output, AVI JPEG or AVI RAW can be used as an initial step. The video can then be converted if needed. FFMPEG is a useful video conversion utility for any operating system. The example below converts an AVI file to Quicktime Prores:

ffmpeg -i file.avi -vcodec prores -profile 3 -an file.mov

5.3 Node compositing

The Node Editor is a powerful Blender feature that allows a user to graphically access elements of the API, as well as combine different visualization layers into one final composite before feeding it to the rendering engine. The Node Editor can be accessed via the Editor drop-down selector in the lower left of the GUI.

Nodes represent a particular feature or action in post-processing with inputs and output as well as keyword parameters that can be modified. A node is essentially a graphical representation of a Python function. Sample nodes are shown in figure . Once they are in place they are connected with lines from one output port to another node’s input port (figure ).

image

Figure 5.5. Example nodes used for compositing. Each node has imaging inputs and outputs which can lead to connecting nodes. Example nodes here give starting rendering layers, RGB color corrections, mixture nodes to composite layers and output nodes that connect to the rendering engine.

image

Figure 5.6. This window shows three render layers being combined and passed through a color balance and RGB node before being passed to the compositor. Nodes can be connected by drawing lines with the left mouse button from one output to another image input. Lines can be destroyed with the CTRL key and nodes can be deleted with the X key.

Download available at .

Назад: 4 Lighting
Дальше: 6 Point of view: camera control
Показать оглавление

Комментариев: 0

Оставить комментарий