![Page 1: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/1.jpg)
CS 247 – Scientific VisualizationLecture 11: Scalar Fields, Pt. 7
Markus Hadwiger, KAUST
![Page 2: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/2.jpg)
2
Reading Assignment #6 (until Mar 8)
Read (required):
• Real-Time Volume Graphics, Chapter 2(GPU Programming)
• Real-Time Volume Graphics, Chapters 5.5 and 5.6 (you already had to read - 5.4)(Local Volume Illumination)
• Refresh your memory on eigenvectors and eigenvalues:https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors
![Page 3: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/3.jpg)
Gradient and Directional Derivative
Gradient s of scalar function : (in Cartesian coordinates)
(Cartesian vector components; basis vectors not shown)
But: always need basis vectors! With Cartesian basis:
Markus Hadwiger, KAUST 3
![Page 4: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/4.jpg)
What about the Basis?
On the previous slide, this actually meant
It’s just that the Cartesian basis vectors are the same everywhere...
But this is not true for many other coordinate systems:
4
Cartesiancoordinates
polarcoordinates
![Page 5: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/5.jpg)
What about the Basis?
On the previous slide, this actually meant
It’s just that the Cartesian basis vectors are the same everywhere...
But this is not true for many other coordinate systems:
5
Cartesiancoordinates
polarcoordinates
![Page 6: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/6.jpg)
The Gradient as a Differential Form
The gradient as a differential (differential 1-form) is the “primary” concept
A differential 1-form is a scalar-valued linear function that takes a(direction) vector as input, and gives a scalar as output
Each of the 1-forms takes a (direction) vector as input, gives scalar as output
In the expression of the gradient above, all 1-forms on the right-hand side get the same vector as input
is simply a linear combination of the coordinate differentials
Markus Hadwiger, KAUST 6
![Page 7: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/7.jpg)
The Gradient as a Differential Form
The gradient as a differential (differential 1-form) is the “primary” concept
The directional derivative and the gradient vector
The gradient vector is then defined, such that:
Markus Hadwiger, KAUST 7
![Page 8: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/8.jpg)
Gradient Vectors and Differential 1-Forms
8
from Wikipedia (for u a unit vector),
the function here is
![Page 9: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/9.jpg)
Gradient Vectors and Differential 1-Forms
9
from Wikipedia (for u a unit vector),
the function here is
![Page 10: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/10.jpg)
Gradient Vectors and Differential 1-Forms
10
how about in polar coordinates?
from Wikipedia (for u a unit vector),
the function here is
![Page 11: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/11.jpg)
Gradient Vectors and Differential 1-Forms
11
how about in polar coordinates?
from Wikipedia (for u a unit vector),
the function here is
![Page 12: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/12.jpg)
Gradient Vectors and Differential 1-Forms
12
from Wikipedia (for u a unit vector),
the function here is
1-form (field)
different 1-formsevaluated in some direction
![Page 13: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/13.jpg)
In tensor calculus, first-order tensors can be
• Contravariant
• Covariant
The gradient vector is a contravariant vector
The gradient 1-form is a covariant vector (a covector)
Very powerful; necessary for non-Cartesian coordinate systems
On (intrinsically) curved manifolds (sphere, ...):Cartesian coordinates not even possible
Interlude: Tensor Calculus
Markus Hadwiger, KAUST 13
![Page 14: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/14.jpg)
Interlude: Tensor Calculus
In tensor calculus, first-order tensors can be
• Contravariant
• Covariant
The gradient vector is a contravariant vector
The gradient 1-form is a covariant vector (a covector)
This is also the fundamental reason why in graphics a normal vector transforms differently: as a covector, not as a vector!
(typical graphics rule: n transforms with transpose of inverse matrix)
Markus Hadwiger, KAUST 14
![Page 15: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/15.jpg)
Metric Tensor (Field)
Symmetric second-order tensor field: Defines inner product
Markus Hadwiger, KAUST
![Page 16: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/16.jpg)
Metric Tensor (Field)
Symmetric second-order tensor field: Defines inner product
Markus Hadwiger, KAUST
(2D)
![Page 17: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/17.jpg)
Metric Tensor (Field)
Symmetric second-order tensor field: Defines inner product
Markus Hadwiger, KAUST
(2D)
Cartesian coordinates:
![Page 18: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/18.jpg)
Metric Tensor (Field)
Components referred to coordinates
A second-order tensor field is bi-linear, i.e.,linear in each (vector) argument separately
Therefore, we immediately get:
Markus Hadwiger, KAUST
![Page 19: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/19.jpg)
Tensor Calculus
Highly recommended:
Very nice book,
complete lecture on Youtube!
Markus Hadwiger, KAUST 19
![Page 20: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/20.jpg)
(Numerical) Gradient Reconstruction
We need to reconstruct the derivatives of acontinuous function given as discrete samples
Central differences
• Cheap and quality often sufficient (2*3 neighbors in 3D)
Discrete convolution filters on grid
• Image processing filters; e.g. Sobel (33 neighbors in 3D)
Continuous convolution filters
• Derived continuous reconstruction filters
• E.g., the cubic B-spline and its derivatives (43 neighbors)
![Page 21: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/21.jpg)
Finite Differences
Obtain first derivative from Taylor expansion
Forward differences / backward differences
Markus Hadwiger, KAUST 21
![Page 22: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/22.jpg)
Finite Differences
Central differences
Markus Hadwiger, KAUST 22
![Page 23: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/23.jpg)
Central Differences
Need only two neighboring voxels per derivative
Most common method
gx = 0.5( f(x+1, y, z) – f(x-1, y, z) )
gy = 0.5( f(x, y+1, z) – f(x, y-1, z) )
gz = 0.5( f(x, y, z+1) – f(x, y, z-1) )
f(x-1, y, z) f(x+1, y, z)
f(x, y+1, z)
f(x, y-1, z)
f(x, y, z+1)
f(x, y, z-1)
on a curve
in a volume
![Page 24: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/24.jpg)
Multi-Linear Interpolation
Markus Hadwiger, KAUST 24
![Page 25: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/25.jpg)
Eduard Gröller, Stefan Jeschke 25
Bi-linear Filtering Example (Magnification)
Original image
Nearest neighbor Bi-linear filtering
![Page 26: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/26.jpg)
Bi-Linear Interpolation vs. Nearest Neighbor
nearest-neighbor bi-linear
Markus Hadwiger, KAUST 26
wikipedia
![Page 27: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/27.jpg)
Bi-Linear Interpolation vs. Nearest Neighbor
nearest-neighbor bi-linear
Markus Hadwiger, KAUST
wikipedia
for surfaces,height interpolation:
Bilinear patch (courtesy J. Han)
![Page 28: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/28.jpg)
Bi-Linear Interpolation vs. Nearest Neighbor
nearest-neighbor bi-linear
Markus Hadwiger, KAUST 28
wikipedia
Bilinear patch (courtesy J. Han)
for surfaces,height interpolation:
![Page 29: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/29.jpg)
Consider area between 2x2 adjacent samples (e.g., pixel centers)
Example #1: 1 at bottom-left and top-right, 0 at top-left and bottom-right
Bi-Linear Interpolation
Markus Hadwiger, KAUST 29
![Page 30: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/30.jpg)
Consider area between 2x2 adjacent samples (e.g., pixel centers)
Example #2: 1 at top-left and bottom-right, 0 at bottom-left, 0.5 at top-right
Bi-Linear Interpolation
Markus Hadwiger, KAUST 30
![Page 31: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/31.jpg)
Consider area between 2x2 adjacent samples (e.g., pixel centers):
Given any (fractional) position
and 2x2 sample values
Compute:
Bi-Linear Interpolation
Markus Hadwiger, KAUST 31
![Page 32: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/32.jpg)
Consider area between 2x2 adjacent samples (e.g., pixel centers):
Given any (fractional) position
and 2x2 sample values
Compute:
Bi-Linear Interpolation
Markus Hadwiger, KAUST 32
![Page 33: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/33.jpg)
Weights in 2x2 format:
Interpolate function at (fractional) position :
Bi-Linear Interpolation
Markus Hadwiger, KAUST 33
![Page 34: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/34.jpg)
Interpolate function at (fractional) position :
Bi-Linear Interpolation
Markus Hadwiger, KAUST 34
![Page 35: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/35.jpg)
Interpolate function at (fractional) position :
Bi-Linear Interpolation
Markus Hadwiger, KAUST 35
![Page 36: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/36.jpg)
Bi-Linear Interpolation: Contours
Find one specific iso-contour (can of course do this for any/all isovalues):
Find all where:
Markus Hadwiger, KAUST 36
![Page 37: CS247 spring2021 lecture 11.ppt - Compatibility Mode](https://reader031.vdocuments.site/reader031/viewer/2022012514/618d9639c78d0370427bca89/html5/thumbnails/37.jpg)
Thank you.
Thanks for material
• Helwig Hauser
• Eduard Gröller
• Daniel Weiskopf
• Torsten Möller
• Ronny Peikert
• Philipp Muigg
• Christof Rezk-Salama