2002-02-01 - Part 1 Lecture 9: Scientific visualization Lecture - - PowerPoint PPT Presentation

2002 02 01 part 1
SMART_READER_LITE
LIVE PREVIEW

2002-02-01 - Part 1 Lecture 9: Scientific visualization Lecture - - PowerPoint PPT Presentation

2002-02-01 - Part 1 Lecture 9: Scientific visualization Lecture 10: Scalar algorithms Textbook: Chapter 6.1 and 6.2 Extra: Article by Shen et.al. Exercises: 6.1, 6.2, 6.4, 6.5 Mats Nyl en February 1, 2002 Slide 1 of


slide-1
SLIDE 1

2002-02-01 - Part 1

  • Lecture 9:

– Scientific visualization

  • Lecture 10:

– Scalar algorithms

  • Textbook: Chapter 6.1 and 6.2
  • Extra: Article by Shen et.al.
  • Exercises: 6.1, 6.2, 6.4, 6.5

Mats Nyl´ en February 1, 2002 Slide 1 of 31

slide-2
SLIDE 2

The visualization pipeline

During earlier lectures we have talked about the first (i.e. the data) and the last (i.e. the rendering) part of the pipeline. Now we will start to talk about the middle part. Visulization algorithms

Data Transform Mapping Display

Interactive Feedback

Mats Nyl´ en February 1, 2002 Slide 2 of 31

slide-3
SLIDE 3

Visualization in 1D and 2D

Simple examples of visualization in 1D and 2D:

  • 1D: plotting a function f(x)
  • 2D: contour curves
  • 2D: plotting a vectorfield as directed lines (hedgehogs).

Mats Nyl´ en February 1, 2002 Slide 3 of 31

slide-4
SLIDE 4

1D example: f(x)

  • 1
  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 0.6 0.8 1

  • 10
  • 5

5 10 f(x) x

Mats Nyl´ en February 1, 2002 Slide 4 of 31

slide-5
SLIDE 5

2D contours

Mats Nyl´ en February 1, 2002 Slide 5 of 31

slide-6
SLIDE 6

2D hedgehogs

Mats Nyl´ en February 1, 2002 Slide 6 of 31

slide-7
SLIDE 7

Visualization Roadmap

1D 0D 1D 2D 3D

Dimensionality of the representation

nD 3D 2D

Dimensionality of the computational domain

Lines Curves Attribute Mapping Attribute Icons Mapping Height Fields Pseudo Color Contour Maps Images Tiled Surfaces Stacked Textures Ribbons Volume Rendering Solids Modelling 3D Vector Nets Field Vectors Hedge Hogs Ribbons Points Contour Maps Field Vectors Space Curves Scatter Plots Particles Dot Lines Scatter Plots Particle Tracers Dot Surfaces Mats Nyl´ en February 1, 2002 Slide 7 of 31

slide-8
SLIDE 8

Visualization techniques

Let’s go back to the visualization pipeline again Visulization algorithms

Data Transform Mapping Display

Interactive Feedback

Mats Nyl´ en February 1, 2002 Slide 8 of 31

slide-9
SLIDE 9

Transformations

The first part is about transformation

  • Geometric transformations, for example scaling the coordinates.
  • Topological transformations, for example converting a dataset from

polygonal data to unstructured grid data.

  • Attribute transformations, for example standard vector analysis on the

field.

  • Combined transformations, transformations which affects both the topol-
  • gy and the attributes.

Mats Nyl´ en February 1, 2002 Slide 9 of 31

slide-10
SLIDE 10

Algorithms

The second part is about mapping the data to something that can be visualized (i.e. some 3D model)

  • Scalar algorithms works on scalar data, for example generating contour

lines or isosurfaces.

  • Vector algorithms works on vector data. Showing oriented arrows is an

example of vector visualization.

  • Tensor algorithms works with tensors.
  • Modelling algorithms generates dataset topology or geometry, or sur-

face normals or texture data. For example, generating glyphs oriented according to the vector direction and then scaled according to the scalar value is a combined vector/scalar algorithm.

Mats Nyl´ en February 1, 2002 Slide 10 of 31

slide-11
SLIDE 11

Scalar algorithms

The most elementary algorithms deals with scalar data or data that can be made into scalar

  • Color mapping: map the scalar to a color, and then display that color.

The scalar mapping is implemented using a color lookup table, that is indexed with the scalar. Good choice of the “transfer function” is important for the final result of the visualization.

  • Contouring:

contouring is a natural idea for scalars, in 2D we get contour lines (like the elevation curves on a map), wheras in 3D we get isosurfaces.

  • Scalar generation: since scalar visualization techiniques are simple and

effective methods, we might wish to use these techniques even when visualizing something that isn’t a scalar field. Then we need to generate a scalar.

Mats Nyl´ en February 1, 2002 Slide 11 of 31

slide-12
SLIDE 12

Color mapping - grayscales

The simplest type of colour map is simply a gray scale where white represent the minimum value and black the maximum (or vice versa).

Mats Nyl´ en February 1, 2002 Slide 12 of 31

slide-13
SLIDE 13

Grayscale example

Mats Nyl´ en February 1, 2002 Slide 13 of 31

slide-14
SLIDE 14

Color mapping - continuous

We could also use a continous range of colors.

Mats Nyl´ en February 1, 2002 Slide 14 of 31

slide-15
SLIDE 15

Rainbow example - blue to red

Mats Nyl´ en February 1, 2002 Slide 15 of 31

slide-16
SLIDE 16

Rainbow example - red to blue

Mats Nyl´ en February 1, 2002 Slide 16 of 31

slide-17
SLIDE 17

Color mapping - discontinuous

When the transition of special values are important we could use disconti- nous scales.

Mats Nyl´ en February 1, 2002 Slide 17 of 31

slide-18
SLIDE 18

Contrast example

Mats Nyl´ en February 1, 2002 Slide 18 of 31

slide-19
SLIDE 19

Contouring

Useful scalar technique:

  • Gives contour-curves in 2D
  • Gives iso-surfaces in 3D

Main algorithm is Marching Cubes

Mats Nyl´ en February 1, 2002 Slide 19 of 31

slide-20
SLIDE 20

Marching Cube - The Problem

Extracting the iso-surface from an implicit function, i.e., extracting a sur- face from volume data by solving f(x, y, z) = T.

6 6 7 6 6 6 6 7 6 6 9 9 8 7 9 9 8 7 10 9 8 9 8 7 8

T = 8.5 T = 7

Mats Nyl´ en February 1, 2002 Slide 20 of 31

slide-21
SLIDE 21

Marching Cube

Algorithm from Lorensen and Cline 1987:

  • Treat each cube individually
  • Allow intersections only on the edges or at vertices
  • Pre-calculate all of the necessary information to construct a surface

Mats Nyl´ en February 1, 2002 Slide 21 of 31

slide-22
SLIDE 22

Marching Cube - Summary

  • Create a cube
  • Classify each voxel
  • Build an index
  • Lookup edge list
  • Interpolate triangle vertices
  • Calculate and interpolate normals

Mats Nyl´ en February 1, 2002 Slide 22 of 31

slide-23
SLIDE 23

Using iso-surfaces

One use of iso-surfaces is to animate the iso-value

Mats Nyl´ en February 1, 2002 Slide 23 of 31

slide-24
SLIDE 24

Contouring is ambiguous

In both 2D and 3D contouring is ambiguous.

Mats Nyl´ en February 1, 2002 Slide 24 of 31

slide-25
SLIDE 25

Ambiguity in 3D

OR? Leads to holes!

Mats Nyl´ en February 1, 2002 Slide 25 of 31

slide-26
SLIDE 26

Marching Cubes is simple

/* Determine the marching cubes index */ for ( i= 0, index = 0; i < 8; i++) { if (val1[ nodes[ i]] >= thresh) /* If the nodal value is above the */ index |= CASE_ MASK[ i]; /* threshold, set the appropriate bit. */ triCase = HexaTriCases + index; /* triCase indexes into the MC table. */ edge = triCase->HexaEdges; /* edge points to the list of intersected edges */ for ( ; edge[ 0] > -1; edge += 3 ) { for (i= 0; i< 3; i++) /* Calculate and store the three edge intersections */ { vert = HexaEdges[ edge[ i]]; n0 = nodes[ vert[ 0]]; n1 = nodes[ vert[ 1]]; t = (thresh - val1[ n0]) / (val1[ n1] - val1[ n0]); tri_ ptr[ i] = add_ intersection( n0, n1, t ); /* Save an index to the pt. */ } add_ triangle( tri_ ptr[ 0], tri_ ptr[ 1], tri_ ptr[ 2], zoneID ); /* Store the triangle */ } }

Mats Nyl´ en February 1, 2002 Slide 26 of 31

slide-27
SLIDE 27

Marching cubes - datastructures

static int const HexaEdges[ 12][ 2] = { {0, 1}, {1, 2}, {2, 3}, {3, 0}, {4, 5}, {5, 6}, {6, 7}, {7, 4}, {0, 4}, {1, 5}, {3, 7}, {2, 6}}; typedef struct { EDGE_ LIST HexaEdges[ 16]; } HEXA_ TRIANGLE_ CASES; /* Edges to intersect. Three at a time form a triangle. */ static const HEXA_ TRIANGLE_ CASES HexaTriCases[] = { {- 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 0 */ { 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 1 */ { 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 2 */ { 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 3 */ ...

Mats Nyl´ en February 1, 2002 Slide 27 of 31

slide-28
SLIDE 28

Efficient searching

For large datasets it becomes very inefficient to search all voxels for the

  • surface. A better way is in the paper by Shen et.al.

Isosurfacing in span space with utmost efficiency (ISSUE)

Mats Nyl´ en February 1, 2002 Slide 28 of 31

slide-29
SLIDE 29

Span space

We need only search the voxels that are within the shaded region!

Min Max T T

Mats Nyl´ en February 1, 2002 Slide 29 of 31

slide-30
SLIDE 30

Scalar generation

si = (pi − pl) · (ph − pl) |ph − pl|2

Mats Nyl´ en February 1, 2002 Slide 30 of 31

slide-31
SLIDE 31

Summary and outlook

  • Visualization is about discovery not presentation.
  • Scalar algorithms has an appealing simplicity.
  • Marching cubes can be made efficient
  • Next tuesday we will work through the rest of chapter 6.

– Vector algorithms – Algorithms of special interest in computational fluid dynamics (CFD).

  • Next lecture is an introduction to vector fields and flows.

Mats Nyl´ en February 1, 2002 Slide 31 of 31