View
2
Download
0
Category
Preview:
Citation preview
AMCS / CS 247 – Scientific VisualizationLecture 9: Iso-Surface Lighting; GPU Texturing
Markus Hadwiger, KAUST
2
Reading Assignment #5 (until Oct. 14)
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)
3
Reading Assignment #6 (until Oct. 21)
Read (required):• Real-Time Volume Graphics, Chapter 1
(Theoretical Background and Basic Approaches),from beginning to 1.4.4 (inclusive)
• Real-Time Volume Graphics, Chapter 3.2.3 (Compositing)
• Data Visualization book, Chapter 5 until 5.2 (inclusive)
4
Reading Assignment #7 (until Nov. 4)
Read (required):• Real-Time Volume Graphics, Chapters 5.3, 5.4, 5.5, 5.6
• Real-Time Volume Graphics, Chapter 7(GPU-Based Ray Casting)
• Real-Time Volume Graphics, Chapter 4 (Transfer Functions)until Sec. 4.4 (inclusive)
5
Programming Assignments Schedule (updated)
Assignment 2:• Iso-surface rendering due: Oct 10
Assignment 3:• Volume ray-casting due: Oct 24
----- Eid Al Adha: Oct 25-Nov 2 -----
Assignment 4:• Vector field visualization due: Nov 14
Assignment 5:• Flow visualization due: Nov 28
6
Next Lecture Dates
Lecture 9: 7.10.2012 9:00
Lecture 10: 7.10.2012 16:00, seminar room GMSV (bldg 1, 2nd floor)
Lecture 11: 10.10.2012 9:00
Lecture 12: 10.10.2012 16:00, seminar room GMSV (bldg 1, 2nd floor)
Q&A programming assignment #3: 15.10.2012 17:30Contact: ronell.sicat@kaust.edu.sa
Lecture 13: 14.10.2012 9:00
Lecture 14: 17.10.2012 9:00
Lecture 15: 4.11.2012 9:00
What About Volume Illumination?
Crucial for perceiving shape anddepth relationships
this is a scalar volume (3D distance field)!
Signed Distance Fields
Special case of general volume / scalar field for objects
Volume discretizes embedding
Signed distance to surface
Implicit surface:zero level set
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
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
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
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)
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
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!
15
GPU Texturing
Rage / id Tech 5 (id Software)
Vienna University of Technology 16
Shading Recap
Flat shadingcompute light interaction per polygonthe whole polygon has the same color
Gouraud shadingcompute light interaction per vertexinterpolate the colors
Phong shadinginterpolate normals per pixel
Remember: difference betweenPhong Lighting Model (specular lighting)Phong Shading
Vienna University of Technology 17
Traditional OpenGL Lighting
Phong lighting model at each vertex (glLight, …)Local model only (no shadows, radiosity, …)ambient + diffuse + specular (glMaterial!)
Fixed function: Gouraud shadingNote: need to interpolate specular separately!
Phong shading: evaluate Phong lighting model in fragment shader (per-fragment evaluation!)
Eduard Gröller, Stefan Jeschke 18
Why Texturing?
Idea: enhance visual appearance of surfaces by applying fine / high-resolution details
Vienna University of Technology 19
OpenGL Texture Mapping
Basis for most real-time rendering effectsLook and feel of a surfaceDefinition:
A regularly sampled function that is mapped onto every fragment of a surfaceTraditionally an image, but…
Can hold arbitrary informationTextures become general data structuresSampled and interpreted by fragment programsCan render into textures important!
Vienna University of Technology 20
Types of Textures
Spatial layoutCartesian grids: 1D, 2D, 3D, 2D_ARRAY, …Cube maps, …
Formats (too many), e.g. OpenGLGL_LUMINANCE16_ALPHA16GL_RGB8, GL_RGBA8, …: integer texture formatsGL_RGB16F, GL_RGBA32F, …: float texture formatscompressed formats, high dynamic range formats, …
External format vs. internal (GPU) formatOpenGL driver converts from external to internal
21
Texturing: General Approach
Texture space (u,v) Object space (xO,yO,zO) Image Space (xI,yI)
Parametrization Rendering(Projection etc.)
Texels
Vienna University of Technology
Vienna University of Technology 22
Texture Wrap Mode
How to extend texture beyond the border?Border and repeat/clamp modesArbitrary (s,t,…) [0,1] x [0,1] [0,255] x [0,255]
repeat mirror/repeat clamp border
Eduard Gröller, Stefan Jeschke 23
Texture Reconstruction: Magnification
Bilinear reconstruction for texture magnification (D<0)("upsampling")
Weight adjacent texels by distance to pixel position
Texture space u
-v
X
T(u+du,v+dv) = du·dv·T(u+1,v+1)+ du·(1–dv)·T(u+1,v)+ (1-du)·dv·T(u,v+1)+ (1-du)·(1-dv)·T(u,v)
du
dv(u,v) (u+1,v)
(u+1,v+1)(u,v+1)
Eduard Gröller, Stefan Jeschke 24
Magnification (Bilinear Filtering Example)
Original image
Nearest neighbor Bilinear filtering
25
Solid Texturing
texture defined in 3D
every position in space has a color
coherent textures across corners
26
Solid Texturing Examples
examples for application of 3D textures on a scull and a face
© Univ.Swansea
© Univ.Swansea
Thank you.
Thanks for material• Helwig Hauser
• Eduard Gröller
• Daniel Weiskopf
• Torsten Möller
• Ronny Peikert
• Philipp Muigg
• Christof Rezk-Salama
Recommended