Transcript Document

CSL 859: Advanced
Computer Graphics
Dept of Computer Sc. & Engg.
IIT Delhi
Volumetric Models
Not a Surface
Not a Surface
Volumes

3D fields


Temperature, Pressure
Generally sampled
Constructed by Interpolation
 Filter convolution, in general


Measured or Simulated
CT-scan, Xray
 CFD Simulation


Conversion from surface (B-rep)
Translucence
Note:
b is absorbed, scatterred
and transmitted.
Color = f (a, b)
Color = a
Color = b
f should depend on:
Degree of translucence: α
Depth of a and b
Alpha Blending
f = s + (1-α)d
0 <= α <= 1
Color = f (s, d)
Color = s
Opacity = α
f = αs + (1-α)d
Color = d
f = αss + αdd
Over Blend Operator


[Porter & Duff ’84]
Final fraction:


αout = αa + αb(1- αa)
Final effective Color:
ab
a(1-b)
(1-a)b
(1-a)(1-b)
cout = αaCa + αb(1- αa) Cb?
 Recall pixel has αout fraction of the color
 Cout = [αaCa + αb(1- αa) Cb] / αout

Order Dependent


d' = αs s + (1-αs) d
Examples: αA= 1, αB = 0.4
A
A
B
B
A over B:
d' = 1*CA+(1-1)*CB
B over A:
d'
= 0.4*CB+(0.6)*CA
Order Dependent
Each quad has an opacity of 0.5
Billboarding etc.
Volume Representation

BRDF for every point in space?


Sometimes only a limited information is available,
eg, tissue density in CT scan
Sample Volume


Computable function at any required point
Subdivide space into a 3D grid and sample at grid
points


Voxel
Could be a structured or unstructured grid

With scalar or vector data (sample) per vertex
Grids
Curvilinear
Tetrahedral
Tetrahedral
Volume Illumination




Layers of surfaces
Particles in space
Voxel emissions
Continuous model


[Drebin 98]
“Surfaceness” at every point



Based on differense in material densities
Surface normals from density gradient
Direct sample value -> Color+Opacity map

Transfer function: often domain-dependent
Volume Rendering Techniques


Iso-surface display
Ray-casting





Slice Projection




Image-space accumulation
Back-to-front or Front-to-back
Sample Ray at many t values
Composite
Object space accumulation
Splatting
Shear-warp factorization
3D textures

Multiple transparent planes



Or some other shape
Particles
Slices
Slicing Planes
Particles
•Depth Cues
•Animation
•Shape/Density
Iso-surfaces

Create boundary representation (Brep)


Usually triangles
Render as surfaces
Possibly multiple translucent surfaces
 Surfaces need to be carefully chosen


Large change across them
Iso-surfaces
•Multiple Surfaces with varying opacity
•Can impart thickness
•Clipping planes
Marching Cubes


Corners of a voxel are inside or outside
28 possible configurations



Only 15 are unique
Modulo reflection, rotation, inversion
Create triangles for each case


Store in a table: <e1, e2, e3> …
Compute vertex location by interpolation
Ambiguity
2D Example
Ambiguity Resolution

It’s an aliasing issue


Make consistent with adjacent voxel


There may be loops
Separate out into more cases


Increase resolution
Cube 33 [Chernyaev 1995]
Sample at the center of the voxel
Subdivide voxel cube into tetrahedra
 Marching tetrahedra

Efficiency

Large number of voxels visited
Hierarchical structures to cull voxels
 Span-space tree


Large number of triangles generated

Polygon simplification
Min-Max Kd-Trees
Construction
m0
Root has median min
M10
M11
value; left subtree has
m20 m21 m22 m23
smaller and right
larger
 For each sub-tree,
root has median max
value
 Alternate

[Livnat, Shen & Johnson 1996]
Search

Compare threshold (t ) with min of
root cell,
If greater, test cell at this node, then test
both children
 If less, traverse left
m0

M10
M11
m20 m21 m22 m23
Lattice Sub-Division



[Shen, Hansen et al. 1996]
A range can be represented as a
single point in the span space
Subdivide span
space into a lattice
and place each data
cell into a lattice
element
Lattice Sub-Division
Five cases:
1.
2.
3.
4.
5.
No intersection
Definite intersection
Test max only
Test min only
Test min and max
Voxel Splatting

Traverse voxels front to back


Project voxel into screen-space


Normally one slice at a time
Hexagonal foorprint in general
Accumulate color and opacity to
covered pixels

Filter Kernel drops of contribution away
from center of the voxel
Raycasting
Sample ray at least once per voxel intersected
Ray Integration
x(t) : ray, parameterized by t
s(t): scalar value
c(t): color; emitted light
a(t): absorption coefficient
I
- [a(t’)]dt’
C = c(t) e
O
O
t
dt
Discrete Ray Integration
n
C =
S
0
i-1
Ci
(10
α i)
D
C
0
C’i = Ci + (1-α ) C’i+1
Requires back to front blending: step from n-1 to 0
Alternatively: Use Over operator
Illumination


Phong/Blinn Model
For each sample, evaluate:

C = ambient + diffuse + specular
= constant + I Kd (N.L) + I Ks (N.H)n
 I: emission color at the sample
 N: normal at the sample
Phong’s Model Applicable
C(p) = Cl * Ka + Cl / (K1 + K2* d(x)) *
[Kd * (N(p) . L + Ks * (N(p) . H )n ]
Cl: color of light
ka,kd,ks: ambient, diffusive, specular coefficient
K1,K2: constant (used for depth attenuation)
N(x): normal at x
Normal Estimation
1. Compute the gradient at each corner
2. Interpolate the normal using central difference
y+1
N(x,y,z) = { (f(x+1) - f(x-1))/2,
(f(y+1) - f(y-1))/2,
(f(z+1) - f(z-1))/2 }
z+1
x-1, y-1, z-1
x+1
Transfer Function

Maps from scalar value to opacities




Region of interest: high opaicity (more opaque)
Rest: translucent or transparent
Opacity is typically specified by the user
Examples for computing opacity [Levoy 88]


Isosurface
Region boundary (e.g. between bone and fresh)
Transfer Function
Red
Green
Blue
v
v
v
value
Alpha
v
Fragment Shader
(R, G, B, A)
Draw Region of Interest
Goal: Visualize voxels that are near a
selected threshold value t
 No iso-surface extraction


Alpha test
void AlphaFunc (enum func, clampf ref ) ;

Assign maximum opacity to voxels with value

Construct a transition area with reducing
opacity
t

Normally of constant thickness
Opacity Construction
Maintain a constant isosurface thickness, R
Opacity = k (v-t) ?
Distance to value t is a non-local
operation: involves a search
opacity = 0
opacity = a
Opacity Construction
Assuming a constant gradient, dv/dx: Dv/Dx
(value change per voxel):
opacity = a
value = t
opacity = 0
v ≈ t – Δv/ Δx * R
thickness = R
opacity =
a – a * (t - v(x)) / (R * Δv/Δx)
Texture Mapping
+
Single slice
= 2D image
2D polygon
Textured-mapped
polygon
Volume Texture Mapping
2D Textures
Side view
Volume Textures
Proxy Geometry
z
y
x
• Each xz slice is a texture on a proxy polygon
• Blend polygons (traditionally back to front)
Changing Viewing Direction
y
x
Simply change the view
matrix and re-render
Until …
Changing View Direction
y
x
Until the view direction is near
parallel to the slice planes
Ray through the pixel intersects no
polygon
Re-slice Volume
y
x
Solution:
Re-orient the polygons
In general, pick orientation
most perpendicular to the
viewing direction
Three Textures
• Must reorganize the input textures for different views
• Pre-process and store three separate texture sets
z
y
x
xz slices
yz slices
xy slices
Texture Volume Rendering
Algorithm:
Disable depth test; Enable blending
For (each slice from back to front) {
- bind appropriate texture
- Create a quad corresponding to the slice
- Assign texture coordinates to vertices
- Render (using OpenGL alpha blending)
}
Varying Sampling Rate
d
d’
d’’ > d’ > d
d’’
Artifacts due to different sampling
at neighboring pixels
Solution

Insert intermediate slides to
maintain the sampling rate
d
d’
d’’
Slice switching
y
x
There is a sudden change of slicing direction when the view
vector transits from one major direction to another. The
change (popping artifact) in the image intensity can be quite
visible
Solution
Use Image-space axis-aligned slicing plane:
Modify slicing plane every frame, resulting in small change
Must clip polygons to volume!
3D Texture Mapping
Input texture space is 3D
(0,1,1)
(1,1,1)
Texture coordinates (r,s) -> (r,s,t)
(0,1,0)
(1,1,0)
(r2,s2,t2)
(0,0,0)
(r3,s3,t3)
(1,0,0)
(r0,s0,t0)
(r1,s1,t1)
3D Texture Mapping

Every point inside the volume can now
be sampled
Interpolated from neighboring points
 No need to ensure polygons aligned with
slices


Slicing independent

No need to re-organize into separate 2D
textures
Unstructured Grid



Tetrahedral Models
Re-Sample into a uniform grid (texture)
Render B-rep of each polyhedron


Ray-cast



Transparent polygons
Need to compute the next tetrahedron
Splatting
Ordering is expensive

Order per scan-line in the plane passing that
scanline

Reduces to 2D sorting
Curvilinear Grid


Ordering a little simpler than
unstructured grids
Two step warp
Grid points are effectively arranged into a
3D-array
 Inverse-map from Euclidean to grid space
 Texture look-up
