Книга: 3D Scientific Visualization with Blender
Назад: 1 Introduction
Дальше: 3 Meshes, models and textures

Chapter 2

The interface and windowing set-up

2.1 Interface introduction

For the exercises and descriptions in this book, we shall use the default GUI that loads with Blender. The interface that loads with Blender by default is geared toward a workflow of manipulating data within the 3D view port, animation bar and object metadata, as well as materials, textures and other object and mesh properties. We will augment this for using the Python API and writing data loading scripts. The interface is highly customizable and the reader is encouraged to experiment with GUI organization depending on their particular screen set-up, preferences and visualization goals. The main GUI is shown and described in figure .

image

Figure 2.1. The default Blender GUI that the user will see upon start-up. The main 3D view port allows the user to interactively manipulate and create 3D objects. The left-hand side shows the Object Tools toolbar and the right-hand side the Transform toolbar. The bottom of the screen shows the animation ‘tape deck’ and the far right shows the data outliner and rendering, materials and texture tools.

2.1.1 3D view port

The 3D view port is where most of the interaction with the actual data object takes place. When Blender first opens, the default view shows a triplet of arrows at the origin (figure ). They are colored red, green and blue for the X-, Y- and Z-axes, respectively. To rotate the scene about the white circle at the center of the axes, click, hold and drag the middle mouse wheel. Rotating the middle mouse wheel forward and back will zoom into and out of the scene. The default view of the scene is in perspective, in that parallel lines will converge to a vanishing point on a horizon line (just as a road in a drawing created in a single or two-point perspective will converge to a distant point). The left mouse button moves the red and white 3D cursor around the view port. Any new meshes or objects will be added at the location of the 3D cursor.

image

Figure 2.2. A mesh cube with the origin arrow triplet colored red, green, and blue for the X-, Y-, and Z-axes, respectively. Controls are available for translation, rotation and scaling. The user can grab these handles to manipulate an entire mesh object, or a single vertex, line, or face.

2.1.2 Using the keyboard

Keyboard shortcuts are vital for manipulating 3D data to a position that one needs. Figure shows the numerical keypad and what action each key can perform. The 1, 3 and 7 keys will show the top, bottom and side views. 2, 4, 8 and 6 will rotate the view in 15° increments. Using the keypad is advantageous for exact control and positioning of the view. The central 5 key switches between orthographic and perspective modes. Both views have advantages in planning and executing scientific visualizations. A list of keyboard shortcuts is given in appendix .

image

Figure 2.3. A schematic keypad view of a standard keyboard. The 2, 4, 6 and 8 keys allow the user to rotate the selected object or data container in 15° increments. The 3, 1 and 7 keys shift the view along the line of sight for the X-, Y- and Z-axes, respectively. The 5 key switches the 3D view port between orthographic and perspective modes.

 

Object movement can occur via translation, rotation and scaling (figure ), either in the GUI or via keyboard shortcuts. The bottom of the GUI has a number of drop-down menus for switching between Object and Mesh Edit modes, selecting the rendering style (wireframe, solid, textured, full) and changing the reference frame (figure ). In Mesh Edit mode single or groups of vertices, lines, or faces can be selected (figure ).

image

Figure 2.4. Three Blender mesh objects showing the mouse handles for (a) translation, (b) rotation and (c) scaling. These GUI elements allow the user to manipulate and position objects in the 3D view port []. Copyright 2013 Brian R Kent, publications of the Astronomical Society of the Pacific.

image

Figure 2.5. The drop-down menu for mode selection. The exercises in this book will focus primarily on the Object and Mesh Edit modes.

image

Figure 2.6. The left panel shows a UV-sphere in Object mode. The right panel shows the same sphere with a single face selected in Mesh Edit mode.

2.1.3 Quad view

A particularly useful GUI set-up is quad view. This can be accomplished with CTRL–ALT–Q, and then shows isometric views along the X, Y and Z lines of sight, as well as the view from the active camera (figure ).

image

Figure 2.7. Example Blender GUI configured in quad view showing an N-body simulation of colliding galaxies with the top, side and front views, as well as the view from the currently selected camera. The quad view is useful for visual analysis from multiple directions and what the field of view for the final render will show []. Copyright 2013 Brian R Kent, publications of the Astronomical Society of the Pacific.

2.1.4 UV-view

The UV-editing GUI can be accessed via the drop-down menu at the top of the Blender screen. This splits the main window interface into a 3D view port and UV-editing interface that can be utilized when mapping data to mesh surfaces. This is typically accomplished by entering Mesh Edit mode with the TAB key, right-clicking to select the desired vertices and then pressing the U key to map the image to the surface with one of the projection methods.

2.1.5 Object tools toolbar

The Object Tools toolbar together with the TAB key allows the user to modify the properties of mesh objects. The toolbar will change depending on the object selected; the properties for a selected camera or lighting element will be different than a mesh object (figure (a)). In later sections we will take advantage of azimuthal symmetry and demonstrate the utility of the spin tool (and others) to save time in building models.

image

Figure 2.8. The Object Tools and Transform toolbars which are used to precisely position objects and cursors in the 3D view port. Each of the object properties can be keyframed from the Transform toolbar. By pressing the TAB key and entering Mesh Edit mode, individual elements can be manipulated via the Object Tools toolbar.

image

Figure 2.9. The data outliner in Blender gives a global view of all the objects and associations between them. Child/parent relationships, rendering status and 3D view port status are all reflected in this useful GUI element.

2.1.6 Transform toolbar

The Transform toolbar is an important part of the GUI in that it allows the user to precisely manipulate and refine the location, rotation and scale of a given object. This is often used in conjunction with the keypad controls. Mesh positions can be locked and the 3D cursor can be moved. The viewing distance, known as the ‘clip’, allows control of how far from the currently 3D view point the user can see (figure (b)). This is particularly useful in crowded visualization scenes.

2.1.7 Data outliner

The data outliner (figure ) shows all objects that exist in a scene. It depicts in a hierarchical format which camera is active and what objects are currently contributing to a scene. Objects can be toggled on or off in both the scene and/or final render. This is useful for having alignment guides in the GUI that are absent in the final render. Objects that have common attributes can be grouped together for ease of organization. When working with a visualization scene, the user can select which elements are visible in the 3D view port or are required in the final render. Some objects might be used for alignment or reference when building a scene, but will not be used in an animation or render. At other times, a particular reference data object might be too computationally expensive to put into a test render and be temporarily excluded from the scene until the final render is created.

image

Figure 2.10. The Properties panel where materials, textures, rendering and scene controls can be manipulated. From left to right the panel includes rendering, layers, scenes, world controls, object controls, constraints, modifiers, vertex controls, materials, textures, particle generators and physics simulations.

2.1.8 Properties panel

The Properties panel is a multi-tabbed panel on the right-hand side of the GUI. These include the tabs for rendering, layers, scenes, world controls, object controls, constraints, modifiers, vertex controls, materials, textures, particle generators and physics simulations (figure ). Some of the tabs listed here will be covered in more detail as their features are needed in later sections.

image

Figure 2.11. The Blender animation time line that allows for scaling the frames of an animation as well as viewing keyframe markers. From left to right the buttons indicate the start and end frames, current frame, beginning frame, previous keyframe, reverse play, forward play, next keyframe and end of the animation.

Render. This tab sets the visualization size and resolution, file animation types and metadata. Presets are available for common video types and formats.

Scene layers. This tab is used for masking and blanking out layers in the visualization scene.

Scene properties. Fundamental scene properties including scaling units can be set here. This is also the tab where the rigid body physics simulation parameters are controlled.

World. Setting environmental lighting and background colors can be controlled here depending on whether the visualization will be published as a graphic in a journal or if it will be better suited for a high-definition animation.

Object. GUI configuration and relations to other objects and layers can be controlled here.

Constraints. Mesh objects can have their motion or positions restrained or locked relative to other objects or defined criteria. This is useful when building camera tracks.

Modifiers. Modifiers can be used to extend data objects without increasing the number of vertices or polygons. This is useful when making grids that need to render quickly.

Vertex groups and shape keys. Shape keys are useful for keyframing animations with large numbers of particles, including smooth particle hydrodynamics and N-body simulations.

Materials. An important part of scientific visualization involves selecting between surfaces, grids and point materials to convey a variety of visualization elements. These could include a range of phenomena, such as planetary surfaces, fields lines, or data best conveyed through 3D scatter plots.

Textures. Textures are useful for loading topographic maps and 3D data cubes, which can be brought into layered textures or voxel data structures, respectively.

Particles. The built in Blender particle generator can be used for phenomenological models and tracers for N-body and smoothed particle hydrodynamics (SPH) simulations.

Physics. This engine allows the user to set up forces, gravitational and magnetic fields, and use the rigid and soft body dynamics features.

2.1.9 Animation time line

In order to facilitate moving through a simulation or animation, the Blender GUI provides animation controls (figure ). The animation time line is similar to a set of classic tape deck controls. Rewind, play, fast forward, and click and drag to see all animation and camera movements occurring in the 3D view port. In addition, once keyframes have been set and an object is selected, the user can jump between those keyframes and see them as yellow lines on the time line.

2.2 Windowing set-up for Python

Any of the GUI elements mentioned so far can be swapped and changed with the drop-down window selector present in a corner of each window element. In addition, a window can be separated by SHIFT-clicking in the upper right-hand corner of a window element. In the new window, the same corner can be clicked and dragged to split the window in two. The top element can be changed to a Python script editor and the bottom to a Python terminal console. With the Blender Python API this can be used to script changes to scene objects and mesh constructs, import data into Blender container objects and run tasks in batch that would otherwise be arduous to carry out in the GUI.

2.3 Data types and Python modules

A number of important data formats and key Python modules should be considered when using Blender. These are useful during data import or in performing numerical calculations.

OBJ file (type text/plain). An OBJ file is a simple ASCII text file that contains information about 3D geometry. From the UV coordinate positions of each vertex and normal, a 3D model can be created [].

FITS. The scientific data format used in astronomy—the flexible image transport system (FITS). These files can contain 2D and 3D imaging, spectra and time-series [].

GIS Shapefiles. The vector data format for geographic information systems [] .

MDL Molfile. A chemistry file with atomic coordinates and bond formation for building molecules [].

Image formats. JPEG, GIF, PNG and BMP files can all be imported for use as texture images for 3D surfaces using the UV editor and materials/textures tabs.

2.4 Python libraries

numpy. Libraries for numerical analysis. Numpy is included with Blender by default.

scipy. Math tools and libraries that make use of numpy. Scientific python can be found at .

astropy. An excellent set of core utilities for astronomers using Python [].

BeautifulSoup. A useful utility of parsing XML and HTML tables of data.

Bibliography

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

[2] Murray J D and van Ryper W 1996 Encyclopedia of Graphics File Formats 2nd edn (Paris: O’Reilly)

[3] Hanisch R J, Farris A, Greisen E W, Pence W D, Schlesinger B M, Teuben P J, Thompson R W and Warnock A III 2001 Definition of the Flexible Image Transport System (FITS) Astron. Astrophys.

[4] Scianna A 2013 Building 3D GIS data models using open source software Appl. Geomatics.

[5] Dalby A, Nourse J G, Hounshell W D, Gushurst A K I, Grier D L, Leland B A and Laufer J 1992 Description of several chemical structure file formats used by computer programs developed at Molecular Design Limited J. Chem. Inform Comput. Sci.

[6] Robitaille T P et al 2013 Astropy: a community python package for astronomy Astron. Astrophys.

Назад: 1 Introduction
Дальше: 3 Meshes, models and textures