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.
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.
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.
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 ).
Figure 5.2. The rotation is keyframed (in yellow) during the animation of a torus mesh object.
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.
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.
Building on the previous example, we can have Blender automatically repeat the visualization by adding a cyclic modifier to the Graph Editor.
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.
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.
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
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 ).
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.
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 .