3D Scientific Visualization with Blender

Chapter 6

Point of view: camera control

We will now discuss how to record our visualizations with the movement and tracking of a camera. In Blender the currently selected camera object presents the field of view that will be in the final render. Camera objects have a number of critical parameters: the X, Y, Z location and rotation of the camera, the vector pointing normal to the camera’s ‘film’ plane, the field of view, the viewing projection and the aspect ratio. For example, in figure , the camera is located at position (1,2,3), rotated at 45° along the X-axis, with a 35° field of view in a perspective projection and an aspect ratio of 16:9 (1080p HD quality).

image

Figure 6.1. The 3D view port shows a camera pointing to a spherical mesh, with the Transform toolbar detailing the camera’s exact position and rotation configuration.

6.1 Projection differences: a matter of perspective

Consider the differences in projection in figure . The perspective projection shows all parallel lines along an axis converging to a single point on the horizon line []. This is what the human eye would see. The orthographic projection shows all lines along an axis to be parallel—what is conventionally used in a scientific plot. The use of either depends on how the user wishes to present their data in the visualization.

image

Figure 6.2. Two examples showing (a) a perspective view of a cube mesh and (b) the same mesh with an orthographic projection []. Copyright 2013 Brian R Kent, publications of the Astronomical Society of the Pacific.

6.2 Camera keyframes

A camera object’s location and rotation can be keyframed like any Blender object. In addition, a camera can be attached to a moving track and constrained to point toward a particular object, regardless of the camera’s location. These properties are useful for tracking shots that can add a very dynamic view to an otherwise plain looking visualization.

6.2.1 Example: tracking to an object

At this point we introduce the idea of a constraint. A camera object can be constrained to track to another object—the normal of the ‘film plane’ of the camera will point directly at the defined center of the other object. For many scenarios, it is useful to add an empty object to the visualization scene. The empty object does not render in the visualization and is represented by an orthogonal set of axes in the GUI (figure ). In essence, the camera object will point toward wherever the empty object is located. An empty object can be attached to another object to aid in tracking a moving object during a visualization.

image

Figure 6.3. This view shows the location of an empty axis object. This type of object does not render and can be attached to other meshes so that the camera can follow and track it during a visualization animation.

  • Begin with the default scene upon starting Blender—a cube, camera and lamp.
  • Add an empty object with Add → Empty → Plain Axes.
  • Right-click to select the cube object first and then SHIFT–right-click again to select the empty object.
  • Press CTRL–P to set the cube to the parent empty object.
  • Right-click and choose the camera object.
  • Click the Constraints tab on the right-hand side Properties panel.
  • Choose ‘Track To’ and select the target as ‘Empty’.
  • Select ‘To’ as –Z and ‘Up’ as Y. This will correctly orient the upward and normal directions when looking through the camera field of view.
  • A dashed blue line will now point directly from the camera object to the empty object, showing that no matter where the camera is moved, the tracking between the two objects will always hold during the visualization (figure ).

image

Figure 6.4. A camera object with a ‘Track To’ constraint applied such that the camera will always center its field of view on the empty object that is a parent of the rendered cube. The blue dashed line normal to the camera plane points from the camera object tracking to the object that it follows.

6.2.2 Example: an object following a path

A camera object can be keyframed to move between two points (as described in section  ). However, it can also be set to follow a continuous smooth predetermined path. The Bézier curve object (figure ) can be used to construct this path. The camera object can then be locked to follow the path. This is extremely useful when one wishes to move the camera through a scene while tracking at the same time. The following scenario continues from the previous camera tracking example.

image

Figure 6.5. This panel shows a Bézier curve with a camera attached. The camera is locked to the curve and will follow it through the animation, while pointing to the cube mesh object.

  • Right-click to select the scene camera object—it will highlight orange.
  • In the Transform panel, zero out any offsets with the position and rotation to be 0.0 and 0.0 degrees, respectively, for X, Y and Z.
  • Click Add → Curve → Circle.
  • Select the Object Data tab (figure ) in the Properties panel. Click the check box for ‘Path Animation’, change the frames to 300.
  • On the Animation toolbar, set the frame to zero and then, under path animation, right-click ‘Evaluation Time’ and ‘Insert Keyframe’.
  • On the Animation toolbar, set the frame to zero and then under ‘Path Animation’, set the evaluation time to 300.0, right-click ‘Evaluation Time’ and ‘Insert Keyframe’. The parameterized unit of the evaluation time in this example is the frame number.
  • Right-click to select the camera object again. Click on the ‘Constraints’ icon and add the object constraint called ‘Follow Path’. Change the forward axis to –Z and the ‘Up’ vector to Y.
  • Play the animation and observe that the camera object follows the path with the camera normal vector tangent to the circle.
  • Add another object constraint for the camera—this time a ‘Track To’ constraint. Change the ‘To’ vector to –Z and the ‘Up’ vector to Y.

image

Figure 6.6. This window is found on the Properties panel and is used to keyframe the path animation for a Bézier curve. Once the path is keyframed, an object such as a camera can be locked to the path.

The camera will now follow the Bézier circle path during the animation, while pointing at the cube. If the path is moved or scaled, the camera will follow.

Bibliography

[1] Carlbom I and Paciorek J 1978 Planar geometric projections and viewing transformations ACM comput. Surv.

[2] Kent B R 2013 Visualizing astronomical data with Blender Publ. Astron. Soc. Pac.

Назад: 5 Animation
Дальше: 7 Python scripting
Показать оглавление

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

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