amcs / cs 247 – scientific visualization lecture 9: iso-surface shading, pt. 3 · 2020. 3....

21
AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST

Upload: others

Post on 22-Jan-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

AMCS / CS 247 – Scientific VisualizationLecture 9: Iso-Surface Shading, Pt. 3

Markus Hadwiger, KAUST

Page 2: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

2

Reading Assignment #5 (until Sep 22)

Read (required):• Real-Time Volume Graphics, Chapter 2 (GPU Programming)

• Real-Time Volume Graphics, Chapter 5.3 (Gradient-Based Illumination)

• Real-Time Volume Graphics, Chapter 5.4.1 (Blinn-Phong Illumination)

Page 3: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

3

Application of illumination model to polygon rendering

Constant-intensity shading (flat shading)• single intensity for each polygon

flat Gouraud

Polygon Shading Methods

Page 4: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

4

1. find normal vectors at corners and calculate shading (intensities) there: Ii

I1

I 2

I 3

Gouraud Shading

Page 5: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

5

1. find normal vectors at corners and calculate shading (intensities) there: Ii

2. interpolate intensities along the edges linearly: I, I’

Gouraud Shading

I1

I 2

I 3I= t·I 1+(1-t)·I 2 I'=u·I 2+(1-u)·I 3

Page 6: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

6

1. find normal vectors at corners and calculate shading (intensities) there: Ii

2. interpolate intensities along the edges linearly: I, I’3. interpolate intensities along scanlines linearly: Ip

I1

I 2

I 3I= t·I 1+(1-t)·I 2 I'=u·I 2+(1-u)·I 3

v·I +(1–v)·I '

Gouraud Shading

Page 7: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

7

Phong Shading

Instead of intensities the normal vectors are interpolated, and for every point the shading calculation is performed separately

darklight

dark

Page 8: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

8

Phong Shading Overview

1. normal vectors at corner points

2. interpolate normal vectors along the edges

3. interpolate normal vectors along scanlines& calculate shading (intensities) for every pixel

P

Page 9: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

9

Flat/Gouraud/Phong Comparison

© Paul Heckbert

Page 10: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

What About Volume Illumination?

Crucial for perceiving shape anddepth relationships

this is a scalar volume (3D distance field)!

Page 11: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

Signed Distance Fields

Special case of general volume / scalar field for objects

Volume discretizes embedding

Signed distance to surface

Implicit surface:zero level set

Page 12: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

Local Illumination in Volumes

Interaction between light source and point in the volume

Local shading equation; evaluate at each point along a ray

Use color from transfer function asmaterial color; multiply with light intensity

This is the new "emissive" color in theemission/absorption optical model

Composite as usual

Page 13: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

Local Shading Equations

Standard volume shading adapts surface shading

Most commonly Blinn/Phong model

But what about the "surface" normal vector?

nl l

n

v

h r

specular reflectiondiffuse reflection

Page 14: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

The Gradient as Normal Vector

Gradient of the scalar field is direction of highest change

Local approximation to isosurface at any point:tangent plane = plane orthogonal to gradient

Normal of this isosurface:normalized gradient

-g

largerscalar values

smallerscalar values

Page 15: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

Gradient Reconstruction

We need to reconstruct the derivatives of acontinuous function given as discrete samples

Central differences• Cheap and quality often sufficient (2+2+2 neighbors in 3D)

Discrete convolution filters on grid• Image processing filters; e.g. Sobel (3x3x3 neighbors)

Continuous convolution filters• Derived continuous reconstruction filters

• E.g., the cubic B-spline and its derivatives(4x4x4 neighbors)

Page 16: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

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 17: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

Example: Gaussian Kernel (1D)17

Page 18: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

2D Gaussian Kernel

Markus Hadwiger, KAUST 18

Page 19: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

2D Gaussian Derivative Kernels

Markus Hadwiger, KAUST 19

Page 20: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

Pre-compute gradients at grid points with any method

Store normalized gradient directions in RGB texture

Sample gradient texture in fragment shader: interpolation

Re-normalize after fetch!

nX

nY

nZ

RGB

Pre-Computed Gradients

RGB gradient texture lerp of texture filter renormalize!

Page 21: AMCS / CS 247 – Scientific Visualization Lecture 9: Iso-Surface Shading, Pt. 3 · 2020. 3. 12. · Lecture 9: Iso-Surface Shading, Pt. 3 Markus Hadwiger, KAUST. 2 Reading Assignment

Thank you.

Thanks for material• Helwig Hauser

• Eduard Gröller

• Daniel Weiskopf

• Torsten Möller

• Ronny Peikert

• Philipp Muigg

• Christof Rezk-Salama