PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING...

18
PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDER Alena Ješko, Petr Strakoš, Milan Jaroš, Markéta Hrabánková 26.3.2019, 4.4.2019 1 Blender installation 2 1.1 Blender download and startup ....................... 2 2 Blender basics 2 2.1 New blender version (2.8) .......................... 2 2.2 Open/save vs import/export ........................ 3 2.3 3D viewport .................................. 4 2.4 Object/model/mesh ............................. 4 2.5 Edit mode and modifiers ........................... 7 2.6 Scripting .................................... 8 2.7 Addons ..................................... 8 2.8 Animation ................................... 9 2.9 Sources ..................................... 10 3 Scientific data visualization 10 3.1 Importing scientific data using x3d format ................ 10 3.2 Introducing Covise nodes .......................... 11 3.3 Analyzing Spitfire ............................... 13 4 Rendering on cluster using CyclesPhi 16 4.1 Accessing the Salomon Cluster ....................... 16 4.2 Prepare data on cluster ............................ 17 4.3 Copy data to Salomon ............................ 17 4.4 Scripts ..................................... 17 4.5 Copy data from Salomon .......................... 17 5 Making an animation 17 The course will focus on visualization of large datasets that can come from simu- lations of different physical phenomena (e.g. fluid dynamics, structural analysis, etc.). To create visually pleasing outputs of such data a path tracing rendering method will be used. Most of the course aspects will be covered within popular 3D creation suite Blender. We will work with the brand new version Blender 2.8 and introduce our developed plug-in called Covise Nodes to work with the scientific data inside Blender. Within the course we will show some of the Blender basics, followed by data visualization examples using the plug-in and we finish the course by rendering a final scene on Salomon cluster. IT4Innovations National Supercomputing Center 1

Transcript of PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING...

Page 1: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

PA R A L L E L V I S U A L I Z AT I O NO F S C I E N T I F I C DATA

U S I N G B L E N D E RAlena Ješko, Petr Strakoš, Milan Jaroš,

Markéta Hrabánková

26.3.2019, 4.4.2019

contents1 Blender installation 2

1.1 Blender download and startup . . . . . . . . . . . . . . . . . . . . . . . 2

2 Blender basics 2

2.1 New blender version (2.8) . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.2 Open/save vs import/export . . . . . . . . . . . . . . . . . . . . . . . . 3

2.3 3D viewport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.4 Object/model/mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.5 Edit mode and modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.6 Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.7 Addons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.8 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.9 Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Scientific data visualization 10

3.1 Importing scientific data using x3d format . . . . . . . . . . . . . . . . 10

3.2 Introducing Covise nodes . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3 Analyzing Spitfire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

4 Rendering on cluster using CyclesPhi 16

4.1 Accessing the Salomon Cluster . . . . . . . . . . . . . . . . . . . . . . . 16

4.2 Prepare data on cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.3 Copy data to Salomon . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.4 Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.5 Copy data from Salomon . . . . . . . . . . . . . . . . . . . . . . . . . . 17

5 Making an animation 17

abstractThe course will focus on visualization of large datasets that can come from simu-lations of different physical phenomena (e.g. fluid dynamics, structural analysis,etc.). To create visually pleasing outputs of such data a path tracing renderingmethod will be used. Most of the course aspects will be covered within popular 3Dcreation suite Blender. We will work with the brand new version Blender 2.8 andintroduce our developed plug-in called Covise Nodes to work with the scientificdata inside Blender. Within the course we will show some of the Blender basics,followed by data visualization examples using the plug-in and we finish the courseby rendering a final scene on Salomon cluster.IT4Innovations National Supercomputing Center

1

Page 2: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

1 blender installation

1.1 Blender download and startup

Blender binaries with Covise plug-in have been prepared for Windows and Mac.For Linux we supply an installation script to download all dependencies and installBlender. All can be found at http://blender.it4i.cz/scientific-visualization/covise/.

For Windows or Mac download the binary and then run the executable

• On Windows download the binary from here and run blender.exe.

• On Mac download the binary from here and run blender.app.

For Linux download and run the installation script

• Use terminal to execute the following

$ wget https://code.it4i.cz/blender/blender-covise-bin/raw/

master/linux/blender28_covise.sh

$ chmod +x blender28_covise.sh

$ ./blender28_covise.sh

2 blender basics

2.1 New blender version (2.8)

2.1.1 Why 2.8?

Pros

• A lot of user-friendly changes.

• Faster Cycles rendering.

• EVEE preview renderer.

Cons

• Still beta.

• No documentation.

• No tutorials.

Cons are only temporary because of huge Blender community.This version is still in development, supposed release date is April, maybe. We

just briefly summarize what is new, excessive summary can be found in Source 1and Source 2. Presets for Blender are available when setting up Blender for the firsttime and then in the user settings, see Fig. B-1 and B-3.

2.1.2 New Theme and Icons

Blender 2.80 has a redesigned look, there are two basic themes - dark and light.Their look can be edited in the Preferences. To compare UI look with the oldBlender version see Fig. B-2, that shows Blender 2.79.

Page 3: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

2.1.3 Shortcut Keys

The following keymaps are available:

• Blender 2.8 (new)

• Blender 2.7 (old)

• Industry Compatible (keymap based on typical shortcuts in other 3D apps,see Source 3)

The cheatsheet in CourseBlender/Blender-basics is from Source 4.

2.1.4 Left Click Select

By default, Blender now uses the left mouse button for selection. This way is moreintuitive and you can now fully use Blender with a one-button trackpad or withpen input.

2.1.5 Application templates

When starting a new file, there is now a choice between multiple application tem-plates: General (3D modeling, rendering, etc.) , 2D Animation, Sculpting, VFX(motion tracking etc. for visual effects), Video Editing. For each template a differ-ent startup file can be saved.

2.1.6 Status Bar

At the bottom of windows there is now a status bar. This bar shows:

• Information about what mouse buttons and keys do for each editor, modeand tool, and it updates as you hold modifier keys.

• Messages and progress indicators for tools and jobs.

• Scene statistics.

2.1.7 Pie Menus

Blender now includes a set of pie menus by default, to make more efficient useof the keyboard to group related features. Pie menus are fast because you can usethem via a gesture. Hold the key, swipe in a direction, and release. Over time, userscan gain muscle memory in order to quickly repeat actions. In the default keymap,pie menus are used for Orientation (,), Pivot (.), Viewport (~), Shading (z), Snap(Shift-S) and Proportional Editing Falloff (Shift-O).

Other new features will be mentioned during course and marked by ∗.

2.2 Open/save vs import/export

You can save and load your work as .blend file. Objects/meshes have to be import-ed/exported according to their type, if you can’t see your type, look for add-on (seelater 2.7). Both actions are in File menu, see Fig. B-4.

ª• Save, save, save.

• Pay attention to export settings.

• In general, everything in blender could be done in several ways.

Page 4: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

l• Load blend_file_1.blend (CourseBlender/Blender-basics/blend_files).

• Import propeller.stl CourseBlender/Blender-basics/data .

2.3 3D viewport

You can manipulate with the view by

mouse (middle button) - rotating, zooming, panning.

keyboard (numpad) - rotating (2,4,6,8), projection (5), preset viewpoint (1,3,7,9 +ctrl), toogle camera view (0).

gui (gizmo)∗ - all mentioned, see Fig.B-5.

Overlays menu serves to hide/show things like gizmo, grid, outline selected, seeFig. B-8. For now, you probably don’t want to change anything.

You can change type of Shading and set it in Fig. B-9.

ª• Hotkeys affect the active area, so check that the mouse cursor

is in the area you want to work.

2.4 Object/model/mesh

2.4.1 Selection, transformation and other stuff

As already said, you can select by left click, you can (un)select all (A, alt+A),(un)hide selected object (H, alt+H). The last (de)selected item is called the “ActiveObject” and it is outlined by yellow (the others are orange). There is exactly oneactive object at any time (even when nothing is selected). Many actions in Blenderuse the active object as a reference.

• Hold shift or ctrl to extend or remove selection.

• Right click to open a context menu.

• Box Select tool (B) is default. C for Circle select . W key always returnsto the Box Select tool.

On the right side, there is Outliner, which gives you overview of all objects, seeFig. B-6. You can see object data such as type of the object, un-applied modifiersor vertex groups. You can (un)select, (un)hide or enable/disable objects for selectionor rendering. You can group objects to Collections (∗).

Properties are under the Outliner, see Fig. B-13. There is a lot of tabs (changingaccording to active object), during this course you will use:

object - you can set exact location, rotation and scale (transform).

modifiers - more about this can be found in 2.5.

material - more about this can be found in 2.4.2.

Page 5: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

object data for light - (previously Lamp) you can set type and propertiesof a light source.

The tools on the left in the toolbar(∗), see Fig. B-14, are different from anothercommands, in that they are activated and stay active until changing to another tool.Their settings are displayed in a bar at the top of the 3D viewport Window, see Fig.B-16. You can write exact values here.

Besides Object tab in Properties or the left toolbar, you can transform object alsoby using shortcuts:

g translate (grab),

s scale,

r rotate,

x/y/z limit transformation to one direction,

shift+x/y/z limit transformation to one plane,

rmb discard momentary changes.

You can use different Transform orientation and change Pivot point, see Fig.B-15.

Other useful stuff can be found in top left menu tab called Object, see Fig. B-10:

• apply (ctrl +A),

• clear (alt+G/R/S),

• duplicate (shift+D),

• join (ctrl+J),

• delete (X).

ª• Besides classic Undo (ctrl+Z) and Redo (shift+ctrl+Z), there is his-

tory available under Edit menu.

• For tweaking the settings of the previously applied operation, edi-tors now show a panel in the bottom left corner, see Fig. B-7.

• If you want to export transformed object properly, don’t forget toapply (ctrl + A).

• Left menu also includes ruler, you can set units for appropriatemeasurements in Scene tab in Properties ( ).

• Light icon in Properties changes with different type of Light.

l• Make forest from tree (duplicate, scale...).

• Make forest as Collection.

• If you fail, load blend_file_2.blend.

Page 6: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

Figure 1: Examples of Principled BSDF’s parameters, from Source 5 .

2.4.2 Material

The Principled BSDF shader combines multiple layers into a single and easy to cre-ate material setup. It is based on the Disney principled model also known as the “PBR”shader, making it compatible with other software.

Main (not all) inputs are these (see Fig. B-17):

base color Main (diffuse or metal) surface color.

metallic Mix between dielectric (diffuse and specular with possible transparency)and metallic (fully specular with complex Fresnel).

specular Amount of dielectric specular reflection. Specifies facing (along normal)reflectivity in the most common 0 - 8% range.

roughness Specifies microfacet roughness of the surface for diffuse and specularreflection.

anisotropic Amount of anisotropy for specular reflection.

sheen Amount of soft velvet like reflection near edges, for simulating materialssuch as cloth.

clearcoat Extra white specular layer on top of others. This is useful for materialslike car paint and the like.

transmission Mix between fully opaque surface at zero and fully glass like trans-mission at one.

ª• To see your material in viewport, you should choose rendered

shading (∗) .

• For more information see Source 5 and Source 6

Page 7: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

l• Make forest green (or any material you want).

• Change type of the Light source to Sun and move/rotate it accord-ing to your preferences.

• If you fail, load blend_file_3.blend.

2.5 Edit mode and modifiers

The viewport has several modes that allow for the creation, editing and manipula-tion of the mesh models. You’ve been in Object mode until now. You can switchmodes in top left menu, see Fig. B-10 or between Object and Edit mode by TAB.

BUT! Blender 2.8 has new feature - workspaces - they provide a screen layoutfor specific tasks like modeling, sculpting or texture painting. Each workspace hasan associated object mode, that is automatically activated when switching to thatworkspace.

You can choose Modeling workspace from middle top menu, see Fig. B-11. No-tice the change in object’s looks and menus, see Fig. B-18.

You can select vertex, edge or face, see Fig. B-12. You can use circle select (C), youcan grab, rotate, scale, and/or delete/dissolve selected part of the mesh as in Objectmode. You can extrude (E), subdivide, add vertices (ctrl+RMB), edge or face (F) andmuch more.

With modifiers, you can perform many effects automatically that would other-wise be too tedious to do manually (such as subdivision surfaces) and withoutaffecting the base geometry of your object. You can add several modifiers to a sin-gle object to form The Modifier Stack and Apply a modifier if you wish to makethe changes permanent.

Blender offers a lot of modifiers, but we will use the following

mirror mirrors a mesh along its local axes.

subdivision surface splits the faces of a mesh into smaller faces giving a smoothappearance.

solidify takes the surface of any mesh and adds depth to it.

ª• The change done by modifier is not actually made until you click

Apply, thus it is not visible in Edit mode. You can’t apply modifierin Edit mode.

• Adding objects works differently in Object and Edit mode.

• There are different automatic selections like Select linked, Selectsimilar etc. that can make work easier.

Page 8: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

l• Make an airplane model (see appendix A for help with the follow-

ing steps):

– Make fuselage from cube.

– Add plane objects and make wings.

• Create only one object from the model (not with propeller) and ex-port it (only the airplane, can be checked by importing).

• If you fail, load blend_file_4.blend.

2.6 Scripting

Python scripts are a powerful and versatile way to extend Blender functionality.Most areas of Blender can be scripted, including animation, rendering, importand export, object creation and the scripting of repetitive tasks.

We choose Scripting workspace from middle top menu, see Fig. B-11. We can usetemplates, for example Batch export is very useful.

Output is printed to the system console. If it’s not opened, go to Window >Toggle System Console. Note that this option is only available on Windows. Onother OS, start Blender from a terminal. There is addon that prints this outputto Python console, but it does not work in the new version yet, see Source 7.

l• Try batch export template.

2.7 Addons

Blender comes with some useful Add-ons already, ready to be enabled. But you canalso add your own, or any interesting ones you find on the web. Enable and disablean add-on by checking or unchecking the box on the right of the add-on you chose,as shown in the Fig. B-19 . List of addons compatible with the new version can befound in Source 8.

For add-ons that you find on the web or for your own addons to show up inthe list, you have to install them first by clicking Install from File. . . and providinga .zip or .py file.

ª• If you want an add-on to be enabled every time you start Blender,

you will need to Save User Settings.

Page 9: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

l• Add nicer background by using add-on called Import Images as

Planes (use the image from CourseBlender/Blender-basics/data ).

• Align forest to ground and propeller to airplane by using add-oncalled Easy Align, see Source 9 (install from CourseBlender/Blender-basics/data )).

• If you fail, load blend_file_5.blend.

2.8 Animation

When Animation workspace is selected, 3D viewport window with Camera viewand Dope sheet window are added. Objects can be animated in the following ways:

moving as a whole object Changing their position, orientation or size in time.

deforming object Animating their vertices or control points.

inherited animation Causing the object to move based on the movement of an-other object (e.g. its parent, hook, armature, etc.).

Animation is typically achieved with the use of keyframes. A keyframe is simplya marker in time which stores the value of a property. Blender will automatically de-termine the correct position for all the frames between given keyframes dependingon the chosen interpolation method (e.g. Linear, Bézier, Quadratic, etc.).

The easiest way how to make animation is to

• select keyframe in Dope sheet window,

• make changes to the scene,

• select changed objects,

• press I for adding keyframe and choose properties to store.

ª• Besides chosen interpolation method, you can open Graph editor

and change the curve of the property manually.

l• Make the airplane fly (and propeller spin) by setting properties

to two keyframes (first, last) and only changing location and rota-tion.

• Try to change default to linear interpolation and see the difference.

• If you fail, load blend_file_6.blend.

Page 10: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

2.9 Sources

1 Release notes 2.8 UI - https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/UI

2 Blender Guru about 2.8 - https://www.youtube.com/watch?v=lPVpg4_POww&

list=PLjEaoINr3zgH1JI7FtPX_Q9OGFhP-HCUV

3 Industry Compatible keymap overview - https://developer.blender.org/

T54963

4 Cheatsheet - https://www.artstation.com/zreinhardt

5 Principled BSDF manual page - https://docs.blender.org/manual/en/latest/render/cycles/nodes/types/shaders/principled.html

6 Principled BSDF “how to” - https://www.youtube.com/watch?v=4H5W6C_Mbck&feature=youtu.be

7 Run Script in PyConsole (older version only for now)- https://blenderartists.org/t/run-script-in-pyconsole-menu/588448

8 List of addons that work with 2.8 - https://blenderartists.org/t/list-of-addons-that-work-with-2-8/1132912

9 Easy Align Addon - https://github.com/sergeod9/Easy_Align_Addon

3 scientific data visualization

3.1 Importing scientific data using x3d format

There is a possibility to import scientific data to Blender using x3d format. Suchdata can be output e.g. from ParaView. The x3d format allows to load geometrywith colors, cameras and lights to Blender. The x3d data import has been avail-able in Blender 2.79 and is available also in new version 2.80. Try the x3d importby replicating the following.

• Go to File→ Import in top bar menu.

• Select the X3D Extensible 3D option.

• From the file dialog select boxFlow.x3d file. It is within the course data filesin CourseBlender/Blender-Covise/X3D/.

• Deselect all by Select→ None in 3D Viewport (ALT+A)

To show the analyzed problem in colors do the following.

• In 3D Viewport select either LookDev or Rendered display method (Scrollthe 3D Viewport toolset to the right if necessary. Use the mouse wheel. SeeFig. C-1)

• Turn off the Overlays (Gizmos and outlines) from the 3D Viewport menu.

Loaded data were pre-processed by ParaView. They describe a fluid flow inside asimple geometry represented by two interconnected boxes. There is a middle planeand several generated streamlines. Colors on the plane represet the pressure distri-bution while colors of the streamlines represent the velocity magnitude of the flow.Values in both cases are increasing from blue to red.

Colors on the geometry are stored as vertex colors. This can be analyzed in ShaderEditor.

Page 11: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

• Divide the 3D Viewport window in two by dragging the upper right cornerof the window to the left.

• Change the newly created window from 3D Viewport to Shader Editor byselecting it from the Editor type combo selection in the left corner.

• In the 3D Viewport select a streamline object.

• In the Shader Editor you will see a structure of interconnected node objectsthat represents the streamline material.

• The first node represents the color attribute Col that is part of the object dataand it is used as a base color for the Principled BSDF material shader.

3.2 Introducing Covise nodes

Covise nodes is a specific set of nodes intended for scientific visualization. They arepart of Covise Editor in Blender. To open it go to upper left corner in any of the Blender’seditor window and select Covise Editor. It will show up the editor’s canvas. Tostart working with nodes, create a new node tree by hitting New button. After-wards, you can add any of the available nodes using the Add menu or a shortcutShift+A.

Documentation to Covise nodes is available at https://fs.hlrs.de/projects/

covise/doc/html/modules/index.html (So far we support only few of the Covisemodules and we have simplified the parameter setup for each module to minimaluser level. Therefore not all description from the Covise documentation appliesto our Blender nodes).

To replicate the results from previous x3d example by using Covise nodes, dothe following.

• Open a new file by File→ New→ General.

• Delete all objects in the scene (in 3D Viewport hit A and DELETE)

• Divide the 3D Viewport window in two by dragging the upper right cornerof the window to the left.

• Open the Covise Editor by selecting it in the combo menu for Editor type.

• Create a new node tree using New button from the editor.

• Add the ReadEnsight node from Add→ Input. See Fig. C-2.

• Click the file browser icon on the ReadEnsight node to select the case filewith the data.

• Select the TINY.CASE file from CourseBlender/Blender-Covise/Ensight/Tiny/.

• Press the Execute button from the Covise Editor menu.

• ReadEnsight node populates with description of data stored in the CASE file.

• Write P to 3D Scalar data and SVEL to 3D Vector data.

• Add CuttingSurface node from Add→ Covise. See Fig. C-4.

• Connect Geo 3D output from ReadEnsight to Geo input in CuttingSurface.

• Do the same with Scalar 3D and Data.

• Set Normal in CuttingSurface to (0, 0, -1).

• Set Point in CuttingSurface to (0, 0, -0.05).

Page 12: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

• Add Colors and Collect nodes from Add→ Covise. See Fig.C-5,C-6.

• Connect Data output of CuttingSurface to Data input of Colors node.

• Connect Geo output of CuttingSurface to Geo input of Collect node.

• Connect Data output to Data input from Colors to Collect node.

• Add Blender node from Add→ Output. See Fig. C-7.

• Connect Geo output to Geo input from Collect to Blender node.

• Press the Execute button.

You will see the horizontal slice through the analyzed geometry. Switch 3DViewport to eiter LookDev or Rendered display mode to see the colors. Colorsrepresent the pressure distribution within the cutting surface. In case you facesome problems, you can recreate the state of the scene by loading the tinyEx.blendfrom CourseBlender/Blender-Covise/Ensight/.

To complete the example, you have to visualize the streamlines in the scene.

• Add the Tracer node from Add→ Covise. See Fig. C-8.

• Set No Start Point to 15.

• Set Start Point 1 to (-0.4, 0.29, -0.01).

• Set Start Point 2 to (-0.4, 0.52, 0.12).

• Set Trace Length to 10.

• Connect Geo 3D output from ReadEnsight to Geo input in Tracer.

• Connect Vector 3D output from ReadEnsight to Data input in Tracer.

• Add another Collect and Colors node.

• Connect Lines output from Tracer to Geo input in Collect node.

• Connect Data output from Tracer to Data input in Colors node.

• Connect Data output from Colors to Data input in Collect node.

• Add another Blender node.

• Connect Geo output from Collect to Geo input in Blender node.

• Set Name to COVISE1 and Curve Radius to 0.003 in Blender node.

• Hit the Execute button (change to correct file path in ReadEnsight node, if youused tinyEx.blend for loading the scene state).

You will see the streamlines inside the analyzed geometry. Switch 3D Viewportto eiter LookDev or Rendered display mode to see the colored streamlines. Colorsrepresent the velocity magnitude of the flow. In case you face some problems, youcan load this state of the scene by loading the tinyEx1.blend from CourseBlender/Blender-Covise/Ensight/.

Page 13: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

3.3 Analyzing Spitfire

As another example we take a CFD analysis of a Spitfire plane. It is much biggerexample, that might represent a typical data analyzed in practice. The CFD resultshave been computed in OpenFOAM and stored in EnSight format. The data arestored in CourseBlender/Blender-Covise/Ensight/Spitfire/. The data cover steady-stateanalysis of the flow around the plane. The plane’s propeller is modelled as MovingReference Frame (MRF), which provides non-symmetrical results. We will analyzepressure of the flow acting on the planes body and the flow’s velocity field rep-resented by streamlines. We will create a short animation by moving the cameraover the scene.

• Open a new file by File→ New→ General.

• Delete all objects in the scene (in 3D Viewport hit A and DELETE).

• Divide the 3D Viewport window in two by dragging the upper right cornerof the window to the left.

• Open the Covise Editor by selecting it in the combo menu for Editor type.

• Create a new node tree using New button from the editor.

• Add the ReadEnsight node from Add→ Input.

• Click the file browser icon on the ReadEnsight node to select the case filewith the data.

• Select the OF.CASE file from CourseBlender/Blender-Covise/Ensight/Spitfire/.

• Press the Execute button from the Covise Editor menu.

• ReadEnsight node populates with description of the data stored in the CASEfile.

• Write p to 2D Scalar data and U to 3D Vector data.

• Add Blender node from Add→ Output.

• Connect Geo 2D output from ReadEnsight to Geo input in Blender.

• Press the Execute button to show the 2D geometry.

• In 3D Viewport select those parts of geometry that enclose the control volume(it is geoOut_2D_el_2, geoOut_2D_el_3, geoOut_2D_el_5).

• Hide it by writing 1,4,6-20 into Choice field of ReadEnsight and by pressingthe Execute again (only the plane will be shown).

Use spitfireEx.blend from CourseBlender/Blender-Covise/Ensight/ in case you want toload the scene in this state.

Now, lets visualize the pressure on the plane’s body.

• Add Colors and Collect nodes from Add→ Covise.

• Remove connection between the nodes ReadEnsight and Blender (click onGeo input, move the connection outside the node and release mouse button).

• Connect Geo2D output of ReadEnsight to Geo input of Collect node.

• Connect Scalar 2D output of ReadEnsight to Data input of Colors node.

• Connect Data output to Data input from Colors to Collect node.

• Connect Geo output to Geo input from Collect to Blender node.

Page 14: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

• Press the Execute button (change to correct file path in ReadEnsight node,if you used spitfireEx.blend for loading the scene state).

• In 3D Viewport select LookDev display method to see the pressure distribu-tion represented by colors (Scroll the 3D Viewport toolset to the right if neces-sary. Use the mouse wheel.)

• Divide the Covise Editor window in two by dragging the upper left cornerof the window downwards.

• Change the newly created window from Covise Editor to Shader Editor by se-lecting it from the Editor type combo selection in the left corner.

• Select any geometry representing the plane (either by clicking in 3D Viewportor in the collection tree in the Outliner).

• The Shader Editor populates with material setting of the selected part (noticea ColorRamp between Attribute and PrincipledBSDF node).

• Use sliders on color map inside the ColorRamp node to interactively changethe colors (Values increase from left to right making blue color representthe lowest values and red the highest. You can reduce/increase the number ofcolor stops by minus/plus icon).

Use spitfireEx1.blend from CourseBlender/Blender-Covise/Ensight/ in case you wantto load the scene in this state.

We continue by adding streamlines around the plane.

• Add the Tracer node from Add→ Covise.

• Create two Spheres to use them as dummy objects for tracer start points(in 3D Viewport hit SHIFT+A to open the Add menu and add UV Spherefrom Mesh menu).

• Select spheres (use SHIFT key for multiple selection) and move them to the Col-lection (use M shortcut in 3D Viewport for moving to collection).

• Scale the spheres to suitable size using either Scale from the Tools menuor the S shortcut.

• Move the spheres in front of the plane (use G shortcut) and position themso the imaginary connecting line between the spheres goes diagonally fromlower left corner to upper right corner and with the propeller somewherein the middle.

• From the Outliner editor (the most right window in Blender) drag the Sphereto the field Object 1 in Tracer node.

• Do the same with Sphere.001 and Object 2 field.

• Set No Start Point to 25.

• Set Trace Length to 20.

• Connect Geo 3D output from ReadEnsight to Geo input in Tracer.

• Connect Vector 3D output from ReadEnsight to Data input in Tracer.

• Add another Collect and Colors node.

• Connect Lines output from Tracer to Geo input in Collect node.

• Connect Data output from Tracer to Data input in Colors node.

Page 15: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

• Connect Data output from Colors to Data input in Collect node.

• Add another Blender node.

• Connect Geo output from Collect to Geo input in Blender node.

• Set Name to COVISE1 and Curve Radius to 0.020 in Blender node.

• Press the Execute button (change to correct file path in ReadEnsight node,if you used spitfireEx1.blend for loading the scene state).

• Change the streamlines color by editing its ColorRamp in Shader Editor.

• Hide the Sphere objects in the Viewport and in the Renderer by togglingthe respective visibilities in the Outliner.

After the last Execute operation the color setting for the pressure distributionon the plane’s surface has changed to the default one. To get back the previ-ous user setting select any object from the plane’s geometry and in Shader Editorcopy the ColorRamp from geoOut_2D_el_* to geoOut_2D_el_*.001 and reconnect itto Attribute and Principled BSDF nodes instead of default ColorRamp. You canalso use spitfireEx2.blend from CourseBlender/Blender-Covise/Ensight/ to load the scenein this state.

Now we will add Camera, Lights, etc. and make a short animation.

• In 3D Viewport add Camera by SHIFT+A→ Camera (move the object to Col-lection if not there).

• Switch to camera view by pressing 0 (zero on numpad) or from View →Cameras→ Active Camera.

• In Sidebar (shortcut N) of 3D Viewport toggle on the Lock Camera to Viewand position the camera by manipulating the view. Set it, so the plane isviewed from the front and fills the camera view.

• Turn off the Lock Camera to View.

• In Properties editor (below the Outliner on the right) select Output bookmarkand set the End frame to 60 and Frame Rate to 30fps.

• In Timeline editor (bottom window in Blender) move to the first frame.

• In 3D Viewport select the camera and insert keyframe by pressing I and setLocRot from the menu.

• Move frame in Timeline editor to 20.

• Move and rotate the camera to the position you like and insert another keyframewith LocRot.

• Move frame in Timeline editor to 40.

• Move and rotate the camera to another position and insert keyframe.

• Move frame in Timeline editor to 60.

• Move and rotate the camera and insert the last keyframe.

• By playing the animation in Timeline editor, camera starts moving while in-terpolating from one keyframe position to another.

• Add the sunlight by Add→ Light→ Sun in 3D Viewport.

• Move the light to (-2.6, 3.3, 6.9) and rotate it around X axis to -42◦.

Page 16: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

• Add another sunlight as duplicate (SHIFT+D) of the first one and move itto (0.17, 5.7, 6.9).

• Add one more sunlight and move it to (3.5, 3.3, 6.9).

• Select the cockpit glass and add new material in Shader Editor. See Fig. C-3.

• Add the Transparent BSDF, Glossy BSDF, and Mix Shader from Add →Shader.

• Set Roughness in Glossy BSDF to 0.2.

• Set Factor in Mix Shader to 0.5.

• Connect BSDF outputs of Transparent BSDF and Glossy BSDF to Shaderinputs of Mix Shader.

• Connect Mix Shader’s output to Surface input of Material Output.

• Add one more light to the cockpit area to light it up. Use Add → Light →Point and set its location to (0, -0.5, -3.65).

• In Properties editor (below the Outliner on the right) select Renderer book-mark and set the Cycles as a Renderer Engine.

• Save the scene by File→ Save As.

The final scene setup can be loaded from spitfireEx3.blend at CourseBlender/Blender-Covise/Ensight/.

4 rendering on cluster using cyclesphiWe have modified the kernel of the Blender Cycles rendering engine and then ex-tended its capabilities to support the HPC environment. We call this version Cycle-sPhi and it supports following technologies:

• OpenMP

• MPI

• Intel Xeon Phi (KNC, KNL)

• Extended vectorization support

• AVX, AVX2, AVX-512

4.1 Accessing the Salomon Cluster

Open terminal and connect to Salomonhttps://docs.it4i.cz/general/shell-and-data-access/#salomon-cluster

• Linux/Mac:

$ ssh [email protected]

• Windows (putty): https://docs.it4i.cz/general/accessing-the-clusters/

shell-access-and-data-transfer/putty/

Page 17: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

4.2 Prepare data on cluster

Copy prace2019 to home directory

[username@salomon]$ cp -r /scratch/temp/prace/parallel_visualization/

prace2019 ~/.

4.3 Copy data to Salomon

Copy spitfireEx3.blend from the local machine to the clusterhttps://docs.it4i.cz/general/shell-and-data-access/#salomon-cluster_1

• Linux/Mac:

$ scp spitfireEx3.blend [email protected]:~/prace2019/data/

• Windows (WinSCP)

4.4 Scripts

• Edit run_job.sh

[username@salomon]$ vim ~/prace2019/scripts/run_job.sh

#!/bin/bash

#frames: 1-60, ~/prace2019/data/spitfireEx3.blend

qsub -J1-60 -v ’blend_file=spitfireEx3’ $HOME/prace2019/scripts/

blender_icc_mix.sh

• Run run_job.sh

[username@salomon]$ cd ~/prace2019

[username@salomon]$ ./scripts/run_job.sh

4.5 Copy data from Salomon

Copy results from the cluster to the local machinehttps://docs.it4i.cz/general/shell-and-data-access/#salomon-cluster_1

• Linux/Mac:

$ scp -r [email protected]:~/prace2019/data/spitfireEx3 ~/

results/.

• Windows (WinSCP)

5 making an animation• Open Blender2.80 on the local machine.

• In the main menu go to File→ New→ Video Editing.

• In the sequencer menu go to Add → Image/Sequence and go to results

folder, select all png files (press A) and choose Add Image Strip.

Page 18: PARALLEL VISUALIZATION OF SCIENTIFIC DATA USING BLENDERprace.it4i.cz/sites/prace.it4i.cz/files/files/blender-03-2019-handson.pdf · data inside Blender. Within the course we will

Visualization of scientific data using Blender

• In the left settings set Frame Start = 1, Frame End = 60, Frame Rate = 30,Output folder = ’results/’, File format=’Ffmpeg video’.

• In the main menu go to File→ Save, write the name of the new blend file andchoose Save Blend File.

• In the main menu go to Render→ Render Animation.