Title: CSL%20859:%20Advanced%20Computer%20Graphics
1CSL 859 Advanced Computer Graphics
- Dept of Computer Sc. Engg.
- IIT Delhi
2Volumetric Models
3Not a Surface
4Not a Surface
5Volumes
- 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)
6Translucence
Note b is absorbed, scatterred and
transmitted.
Color f (a, b)
Color a
Color b
f should depend on Degree of translucence
a Depth of a and b
7Alpha Blending
f s (1-a)d
0 lt a lt 1
Color f (s, d)
f as (1-a)d
Color s
Opacity a
Color d
f ass add
8Over Blend Operator
- Porter Duff 84
- Final fraction
- aout aa ab(1- aa)
- Final effective Color
- cout aaCa ab(1- aa) Cb?
- Recall pixel has aout fraction of the color
- Cout aaCa ab(1- aa) Cb / aout
9Order Dependent
- d' as s (1-as) d
- Examples aA 1, aB 0.4
A over B d' 1CA(1-1)CB
A
B
B over A d'
0.4CB(0.6)CA
A
B
10Order Dependent
Each quad has an opacity of 0.5
11Billboarding etc.
12Volume 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
13Grids
Tetrahedral
Curvilinear
Tetrahedral
14Volume 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 -gt ColorOpacity map
- Transfer function often domain-dependent
15Volume Rendering Techniques
- Iso-surface display
- Ray-casting
- Image-space accumulation
- Back-to-front or Front-to-back
- Sample Ray at many t values
- Composite
- Slice Projection
- Object space accumulation
- Splatting
- Shear-warp factorization
- 3D textures
- Multiple transparent planes
- Or some other shape
- Particles
- Slices
16Slicing Planes
17Particles
- Depth Cues
- Animation
- Shape/Density
18Iso-surfaces
- Create boundary representation (B-rep)
- Usually triangles
- Render as surfaces
- Possibly multiple translucent surfaces
- Surfaces need to be carefully chosen
- Large change across them
19Iso-surfaces
- Multiple Surfaces with varying opacity
- Can impart thickness
- Clipping planes
20Marching 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 lte1, e2, e3gt
- Compute vertex location by interpolation
21Ambiguity
2D Example
22Ambiguity Resolution
- Its an aliasing issue
- Increase resolution
- Make consistent with adjacent voxel
- There may be loops
- Separate out into more cases
- Cube 33 Chernyaev 1995
- Sample at the center of the voxel
- Subdivide voxel cube into tetrahedra
- Marching tetrahedra
23Efficiency
- Large number of voxels visited
- Hierarchical structures to cull voxels
- Span-space tree
- Large number of triangles generated
- Polygon simplification
24Min-Max Kd-Trees
- Root has median min value left subtree has
smaller and right larger - For each sub-tree, root has median max value
- Alternate
Livnat, Shen Johnson 1996
25Search
- 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
m21
m22
m20
m23
26Lattice 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
27Lattice Sub-Division
- Five cases
- No intersection
- Definite intersection
- Test max only
- Test min only
- Test min and max
28Voxel Splatting
- Traverse voxels front to back
- Normally one slice at a time
- Project voxel into screen-space
- Hexagonal foorprint in general
- Accumulate color and opacity to covered pixels
- Filter Kernel drops of contribution away from
center of the voxel
29Raycasting
Sample ray at least once per voxel intersected
30Ray Integration
x(t) ray, parameterized by t
s(t) scalar value c(t) color emitted
light a(t) absorption coefficient
31Discrete Ray Integration
n
i-1
C S C (1- a )
i i
0
0
D
0
C
C C (1-a ) C
i i i1
Requires back to front blending step from n-1
to 0
Alternatively Use Over operator
32Illumination
- 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
33Phongs 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
34Normal Estimation
- Compute the gradient at each corner
- Interpolate the normal using central difference
y1
N(x,y,z) (f(x1) - f(x-1))/2,
(f(y1) - f(y-1))/2,
(f(z1) - f(z-1))/2
z1
x-1,
y-1,
z-1
x1
35Transfer 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)
36Transfer Function
Red
v
Green
(R, G, B, A)
v
Blue
v
Alpha
value
v
Fragment Shader
37Draw 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 t
- Construct a transition area with reducing opacity
- Normally of constant thickness
38Opacity Construction
Maintain a constant isosurface thickness, R
Opacity k (v-t) ?
Distance to value t is a non-local operation
involves a search
opacity a
opacity 0
39Opacity Construction
Assuming a constant gradient, dv/dx Dv/Dx
(value change per voxel)
thickness R
opacity a value t
opacity a a (t - v(x)) / (R ?v/?x)
opacity 0 v t ?v/ ?x R
40Texture Mapping
Single slice 2D image
Textured-mapped polygon
2D polygon
41Volume Texture Mapping
2D Textures
Side view
42Volume Textures
Proxy Geometry
- Each xz slice is a texture on a proxy polygon
- Blend polygons (traditionally back to front)
43Changing Viewing Direction
Simply change the view matrix and re-render
Until
44Changing View Direction
Until the view direction is near parallel to the
slice planes Ray through the pixel intersects no
polygon
45Re-slice Volume
- Solution
- Re-orient the polygons
- In general, pick orientation most perpendicular
to the viewing direction
46Three Textures
- Must reorganize the input textures for different
views - Pre-process and store three separate texture sets
xz slices
yz slices
xy slices
47Texture 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)
48Varying Sampling Rate
d
d
d
d gt d gt d
Artifacts due to different sampling at
neighboring pixels
49Solution
- Insert intermediate slides to maintain the
sampling rate
50Slice switching
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
51Solution
Use Image-space axis-aligned slicing plane
Modify slicing plane every frame, resulting in
small change
Must clip polygons to volume!
523D Texture Mapping
Input texture space is 3D Texture coordinates
(r,s) -gt (r,s,t)
(0,1,1)
(1,1,1)
(0,1,0)
(1,1,0)
(1,0,0)
(0,0,0)
533D 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
54Unstructured Grid
- Tetrahedral Models
- Re-Sample into a uniform grid (texture)
- Render B-rep of each polyhedron
- Transparent polygons
- Ray-cast
- Need to compute the next tetrahedron
- Splatting
- Ordering is expensive
- Order per scan-line in the plane passing that
scanline - Reduces to 2D sorting
55Curvilinear 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