IN4089 - Lecture 08 - Indirect Volume Visualization and Vectorfields-Pdfjam
IN4089 - Lecture 08 - Indirect Volume Visualization and Vectorfields-Pdfjam
2D visualization of slice
images
Indirect Volume arbitrary cut planes (multi
planar reconstruction, MPR)
Visualization
Indirect 3D visualization
Extract and reformat
structures: isosurfaces
IN4089 Data Visualization
Martin Skrodzki – Computer Graphics & Visualization Direct 3D visualization
Interactively classify
structures: direct volume
rendering (DVR)
Isosurface Raycasting
Intensity
Eye
Pixel
4
Indirect Volume Visualization
Idea: Make the inner parts of the volume
visible by extracting contours/surfaces of
features and visualize these
contours/surfaces (indirect)
Back to Indirect Volume Rendering
Iso-contours Iso-contours
8 9
Iso-contours Recap: Volume data
• 3D grid of data points, indices: m, n, k
• one scalar value per data point
set of points where • density, concentration
the scalar field f • pressure
has a given iso-value c • temperature →
→ → 𝑓𝑓 𝑥𝑥 : ℝ3 → ℝ
{𝑥𝑥 ∈ ℝ𝑛𝑛 : 𝑓𝑓(𝑥𝑥 ) = 𝑐𝑐} • velocity
• etc … 𝑓𝑓[𝑚𝑚, 𝑛𝑛, 𝑘𝑘]: ℕ3 → ℕ
10 11
Voxel Cell
Sampled data point Voxel centers = Vertices of the cube
example: iso-value c = 8
12 13
Marching Squares Algorithm (2D) Marching Squares Algorithm (2D)
v3 v4 grid value v3 v4 grid value
• For all cells with data values larger and ≥c • For all cells with data values larger and ≥c
<c <c
smaller than iso-value c at the grid points vi smaller than iso-value c at the grid points vi
v1 v2 v1 <c v1 v2 v1 <c
v2 <c v3 v4 v2 <c
v3 >c v3 >c
v4 >c • Find cell edges with intersection v4 >c
v1 v2
14 15
v1 v2
16 17
Marching Squares Algorithm (2D) Iso-contours • Discrete Case
v3 v4 grid value
• For all cells with data values larger and ≥c • For all cells with data values larger and
<c
smaller than iso-value c at the grid points vi smaller than iso-value 8 at the grid points vi
v1 v2 v1 <c
v3 v4 v2 <c 10 10
v3 >c
• Find cell edges with intersection v4 >c • Find cell edges with intersection
• Connect intersection points • Connect intersection points
v1 v2 10 10
v3 v4
• Interpolate along the cell edges • Interpolate along the cell edges
v1 v2
example: iso-value c = 8
18 19
• For all cells with data values larger and • For all cells with data values larger and
smaller than iso-value 8 at the grid points vi smaller than iso-value c at the grid points vi 0 1 2 3
10 10
• Find cell edges with intersection • Find cell edges with intersection
4 5 6 7
• Connect intersection points 10 10
• Connect intersection points
8 9 10 11
• Interpolate along the cell edges • Interpolate along the cell edges
12 13 14 15
example: iso-value c = 8
20 21
Marching Squares - Case Tables Marching Squares - Case Tables
≥c • For each vertex compute ≥c • For each vertex compute
<c <c
0 1 2 3
12 13 14 15
____ 0101 = 5 (decimal)
22 23
Solutions
• smallest change of direction
wrt neighboring cells
• ask for user input
Join Contour Break Contour Join Contour Break Contour
http://users.polytech.unice.fr/~lingrand/MarchingCubes/algo.html
• … http://users.polytech.unice.fr/~lingrand/MarchingCubes/algo.html
24 25
Marching Squares - Problem Cases Marching Squares
v3 v4 v3 v4 v3 v4
v1 <c Algorithm
v2 >c
v3 >c ? For each cell (square):
v4 <c
v1 v2 v1 v2 v1 v2 1. Classify each vertex
2. Build an index
3. Get intersected edge list 5
26 27
3D – Connecting 2D Contours
28 29
Marching Cubes (3D) Marching Squares (2D) Excursus: why triangles?
• Most simple surface element
Algorithm
• Unambiguous definition with three points
• For each cell (cube): • For each cell (square):
• Historically: graphics hardware built around triangles
1. Classify each vertex 1. Classify each vertex
2. Build an index 2. Build an index
3. Get intersected edge list 3. Get intersected edge list
4. Find exact intersection by 4. Find exact intersection by
interpolation interpolation
5. Connect intersections to polygon 5. Connect intersections to iso-line
6. Triangulate polygon to iso-surface 30 https://youtu.be/U93RImC-by4 31
32 33
Marching Cubes – Step 2 Marching Cubes – Step 3
Build an index Get edge list
Create an index between 0 and For a given index, access a list of
255 from the binary labeling of cubes edges that contain a
each vertex triangle vertex
Using symmetry of the cube, all
256 cases can be generated
from 15 cases (14 intersected, 1
index: 00000100
…
not intersected)
34 35
IN OUT OUT IN
cubeface cubeface
OUT IN IN OUT
38 39
40 41
Drawing Drawing
• Locate the surface using marching cubes • Locate the surface using marching cubes
• Draw triangles • Draw triangles
• Illuminate/Shade triangles
42 43
𝐼𝐼 💡💡
Phong Reflection Model Shading
⃗
𝐿𝐿 ⃗
𝑛𝑛
𝜃𝜃
𝜙𝜙
• Normal vector n is needed for light ⃗
𝑉𝑉
+ + = reflection calculation
• Can easily be computed per triangle
Ambient Diffuse Specular Phong Reflection (vector orthogonal to the triangle
+ + =
𝑘𝑘𝑎𝑎 (𝐼𝐼𝑎𝑎 ∘ 𝑆𝑆𝑎𝑎 ) 𝑘𝑘𝑑𝑑 (𝐼𝐼𝑑𝑑 ∘ 𝑆𝑆𝑑𝑑 )cos𝜃𝜃 𝑘𝑘𝑑𝑑 (𝐼𝐼𝑑𝑑 ∘ 𝑆𝑆𝑑𝑑 )(cos𝜙𝜙)𝑎𝑎 surface)
• Gives a 'flat' appearance with hard
𝑘𝑘𝑎𝑎 , 𝑘𝑘𝑑𝑑 , 𝑘𝑘𝑠𝑠 : Phong weights
edges
𝐼𝐼𝑎𝑎 , 𝐼𝐼𝑑𝑑 , 𝐼𝐼𝑠𝑠 : Light properties – color (RGB - vector) - typically 𝐼𝐼𝑎𝑎 = 𝐼𝐼𝑑𝑑 = 𝐼𝐼𝑠𝑠
𝑆𝑆𝑎𝑎 , 𝑆𝑆𝑑𝑑 , 𝑆𝑆𝑠𝑠 : Surface properties – color (RGB - vector) - typically 𝑆𝑆𝑎𝑎 = 𝑆𝑆𝑑𝑑 = 𝑆𝑆𝑠𝑠
44 45
Shading Shading
• Normal vector n is needed for light • Normal vector n is needed for light
reflection calculation reflection calculation
• Can easily be computed per triangle • Can easily be computed per triangle
(vector orthogonal to the triangle (vector orthogonal to the triangle
surface) surface)
• Gives a 'flat' appearance with hard • Gives a 'flat' appearance with hard
edges edges
46 47
Shading
• Normal vector n is needed for light
reflection calculation
• Normal per vertex + Interpolation
gives a much smoother impression
• Here n is approximated by the gradient
(see direct volume rendering)
Slides (partially) based on lectures by
Thomas Höllt (TU Delft)
Anna Vilanova (TU Eindhoven)
Markus Hadwiger (King Abdullah University of Science and Technology)
48
Vector Fields
• Example: laminar flows 𝑥𝑥⃗ → 𝑣𝑣(𝑥𝑥) • Visualization of vectors: arrow plots (“hedgehog” plots), LIC
• Example: turbulent flows 𝑥𝑥⃗ → 𝑣𝑣(𝑥𝑥, 𝑡𝑡) • Integral curves: streamlines, pathlines, streaklines, timelines
(here just for Euclidean domain; analogous on general manifolds) • Integral surfaces: streamsurfaces, pathsurfaces, streaksurfaces
Integral curve
4 5
Flow/Vector Field Visualization: Direct/Vectors
𝑥𝑥 𝑅𝑅 x
z
𝑦𝑦 = 𝐺𝐺
𝑧𝑧 𝐵𝐵
6 7
11 Cabral and Leedom, Imaging Vector Fields Using Line Integral Convolution, Proceedings of SIGGRAPH '9312
Cabral and Leedom, Imaging Vector Fields Using Line Integral Convolution, Proceedings of SIGGRAPH '9313 15
Line Integral Convolution (LIC) Line Integral Convolution (LIC)
• Start with dense flow field • Start with dense flow field
• Cover the domain with noise • Cover the domain with noise
• Blur noise tangential to vector
field
16 17
• Result:
• Along flow lines visually coherent values • For function 𝑓𝑓 and kernel 𝑘𝑘 of size 2𝐿𝐿 (1D)
• LIC: convolve along the vector field 𝑝𝑝1 𝑝𝑝2
𝑝𝑝0
𝐿𝐿
.1 .2 .4 .2 .1 𝑝𝑝−1
𝑓𝑓 ∗ 𝑘𝑘 𝑥𝑥 = � 𝑓𝑓 𝑥𝑥(𝑡𝑡 + 𝜏𝜏) ⋅ 𝑘𝑘 𝜏𝜏 𝑑𝑑𝑑𝑑
−𝐿𝐿
−𝐿𝐿 𝐿𝐿 𝑝𝑝−2
18 19
Integral Curves / Stream Objects
20 21
• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time
• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 22 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 23
Flow/Vector Field Visualization: Indirect Flow/Vector Field Visualization: Indirect
• Streamline • Streamline
• Curve parallel to the vector field in each point for a fixed time • Curve parallel to the vector field in each point for a fixed time
• Pathline • Pathline
• Describes motion of a massless particle over time • Describes motion of a massless particle over time
• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time
• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 24 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 25
• Pathline • Pathline
• Describes motion of a massless particle over time • Describes motion of a massless particle over time
• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time
• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 26 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 27
Flow/Vector Field Visualization: Indirect Flow/Vector Field Visualization: Indirect
• Streamline • Streamline
• Curve parallel to the vector field in each point for a fixed time • Curve parallel to the vector field in each point for a fixed time
• Pathline • Pathline
• Describes motion of a massless particle over time • Describes motion of a massless particle over time
• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time
• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 28 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 29
𝑝𝑝 𝑠𝑠 𝑝𝑝 𝑠𝑠
30 31
Numerical Integration: Euler Numerical Integration: Euler
Simple 2D model:
• Testing Example 𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦
𝑣𝑣𝑥𝑥 −𝑦𝑦 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2
𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥
𝑣𝑣𝑦𝑦 = 𝑥𝑥/2
• Exact solution: ellipses Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1
1
𝑣𝑣 𝑝𝑝0 =
0
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5 Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 −1
1 1
𝑣𝑣 𝑝𝑝0 = 𝑣𝑣 𝑝𝑝1 =
0 0.25
0 1 0.5
𝑝𝑝 𝑠𝑠1 = + ⋅ 0.5 =
−1 0 −1
34 35
Numerical Integration: Euler Numerical Integration: Euler
Simple 2D model: Simple 2D model:
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5 Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 −1
1
𝑣𝑣 𝑝𝑝1 =
0.25
0.5 1
𝑝𝑝 𝑠𝑠2 = + ⋅ 0.5
−1 0.25
1
=
−0.875
36 37
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5 Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 −1
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.25
−1
38 39
Numerical Integration: Euler Better: Runge Kutta
Simple 2D model: Simple 2D model:
𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦 • Idea: cut short the curve arc 𝑣𝑣𝑥𝑥 −𝑦𝑦
𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 • 2nd order RK: 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2
𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥
1. Do half Euler step
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 2. Evaluate flow vector there
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.25 3. Use it at the origin
−1
𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.1
−1 𝑝𝑝 𝑠𝑠𝑖𝑖+1
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.01 Δ𝑆𝑆
−1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 ⋅ ⋅ 𝛥𝛥𝛥𝛥
2
40 41
46 47
Slides (partially) based on lectures by
Thomas Höllt (TU Delft)
Anna Vilanova (TU Eindhoven)
Markus Hadwiger (King Abdullah University of Science and Technology)
48