1
Visualisatie BMT Volume visualization Arjan Kok a.j.f.kok@tue.nl - - PowerPoint PPT Presentation
Visualisatie BMT Volume visualization Arjan Kok a.j.f.kok@tue.nl - - PowerPoint PPT Presentation
Visualisatie BMT Volume visualization Arjan Kok a.j.f.kok@tue.nl 1 Lecture overview Transparency Volume rendering Assignment 2 Transparency Makes it possible to see inside or behind objects Complement of transparency
2
Lecture overview
- Transparency
- Volume rendering
- Assignment
3
Transparency
- Makes it possible to see inside or behind objects
- Complement of transparency is opacity
- Opacity defined by alpha value with range [0,1]
- Alpha = 1:
Completely opaque
- Alpha = 0:
Completely transparent
4
Transparency
- Compositing
- R = As Rs + (1 – As) Rb
- G = As Gs + (1 – As) Gb
- B = As Bs + (1 – As) Bb
- A = As + (1 – As) Ab
- Where s refers to the surface of the object,
while subscript b refers to what is behind the obj
- 1-As is called the transmissivity, the amount of light that is
transmitted through the actor
- Important
- Render object in correct order: from back to front
RGBA RbGbBbAb RsGsBsAs
5
Transparency
(0.8, 0, 0, 0.5) (0, 0.8, 0, 0.5) (0, 0, 0.8, 0.5)
(0, 0, 0, 0) (0, 0, 0.4, 0.5) (0, 0.4, 0.2, 0.75) (0.4, 0.2, 0.1, 0.875) (0.1, 0.2, 0.4, 0.875) (0.2, 0.4, 0, 0.75) (0, 0.4, 0, 0.5) (0, 0, 0, 0)
We have to sort the obj from back to front and then render them in that order !!
6
Transparency
- Wrong rendering order: BRG
(0.8, 0, 0, 0.5) (0, 0.8, 0, 0.5) (0, 0, 0.8, 0.5)
(0, 0, 0.4, 0.5) (0, 0, 0, 0) (0.3, 0.2, 0.175, 0.875) (0.4, 0.0, 0.2, 0. 75)
Cs = (0.4, 0, 0.2, 0.75) Cb = (0, 0.8, 0, 0.5)
7
Surface Graphics
- Traditionally, graphics objects are modeled with surface
primitives (surface graphics).
- Continuous in object space
8
Difficulty with Surface Graphics
- Volumetric object handling
- gases, fire, smoke, clouds (amorphous data)
- sampled data sets (MRI, CT, scientific)
- Peeling, cutting, sculpting
- any operation that exposes
the interior
9
Volume Graphics
- Defines objects on a 3D raster, or discrete grid in object
space
- Raster grids: structured or unstructured
- Data sets: sampled, computed, or voxelized
- Peeling,cutting … are easy with a volume model
10
Volume Graphics & Surface Graphics
11
Volume Graphics Applications (simulation data set)
- Scientific data set visualization
12
More Volume Graphics Applications (artistic data set)
- Amorphous entity visualization
- smoke, steam, fire
13
Volume visualization
- Surface rendering
- Shows surfaces at
discrete values (iso- values)
- Volume rendering
- Shows continuous
fields in 3D
- Enables to see through
the data
- Data is seen more
directly; less likely to miss details
14
Volume rendering
Volume rendering methods
- Image-order (“ray casting or ray tracing”)
- Object-order
- Projection types (ray functions)
- Maximum intensity projection
- Average projection
- Distance projection (compute the distance along the ray
at which a scalar value at or above val is first encountered)
- Transparency projection (alpha compositing)
15
Ray Traversal Schemes
16
Image-order volume rendering
- Ray casting
- Image space is traversed
- For each pixel one or more rays are fired into the volume
- Process the data along the ray (using a projection function)
volume image plane
Base plane
17
Image-order volume rendering
18
Image-order volume rendering
- During tracing ray we must sample the volume
- Sample the volume at uniform intervals
- Evaluate at intervals Δt along ray
- Use a discrete representation of the line
- Evaluate at each encountered voxel
a,b,c, - the normalized ray direction vector
19
Image-order volume rendering
- Uniform sampling algorithm
t = t1 // distance where the ray enter the volume initialize v while (t < t2) { // distance where the ray exits the volume x = x0 + a*t y = y0 + b*t z = z0 + c*t v = EvaluateFunction(v, t) t = t + Δt }
20
Image-order volume rendering
21
Image-order volume rendering
- Interpolation function
22
Object-order volume rendering
- Object space (= data set) is traversed
- For each voxel
- Determine projection position on the view pane
- Process data (using voxel and image information)
volume image plane
23
Object-order volume rendering
24
Volume rendering
Volume rendering methods
- Image-order
- Object-order
- Projection types (ray functions)
- Maximum intensity projection
- Average projection
- Distance projection
- Transparency projections (compositing)
25
Maximum intensity projection
- Image pixel is set to
maximum sample value along ray
- Simple(st)
- Provides intuitive
understanding of data
- No depth cues
26
Average projection
- Image pixel is set to
average value along ray
- Simple
- Provides less intuitive
understanding of data
- No depth cues
27
Distance projection
- Image pixel is set to
distance of closest voxel with value larger than requested distance (thresholding)
- Simple
- Depth cues
- Iso-surface projection
28
Projections
29
Transparency projections
- Goal of visualization
- Classification of objects
- Selection of objects
- Volume classification can be done by transfer functions
30
Drebin, et. al.
Original CT Data Fat Tissue Bone Density Color and Opacity Strength Gradient NX NY NZ Shaded Transformed Final Image
31
Transparency projections
- Basic model: (we want to understand structure !!)
- Each point in the volume transmits and emits light
- Opacity and emission along ray:
- Opacity:
α(t)
- Emission:
ρ(t)
t
32
Transparency projections
- Back-to-front
- Alpha-compositing
- and
bg
I ) t ( I ) t ( = = ρ
Ipixel Ibg
) t ( I )) t ( a 1 ( ) t ( ) t ( ) t ( I
1 n n n n n −
− + ρ α =
1 ) t ( 0 = α
) t ( I )) t ( a 1 ( ) t ( ) t ( ) t ( I
1 2 2 2 2
− + ρ α = ∏ α − ρ ∑α =
+ = = N 1 i j j i N i i pixel
)) t ( 1 ( ) t ( ) t ( I
N samples:
) t ( I )) t ( a 1 ( ) t ( ) t ( ) t ( I
1 1 1 1
− + ρ α =
33
Transparency projection
- Back to front
I = I0 for i = 1 .. N do I = ρi αi + (1- αi) I
- Front to back
I = 0 T = 1 for i = N .. 1 do I = I + ρi αi T T = (1- αi) T I = I + T I0
34
Transfer function
- Transfer functions
- Assign opacity (α), and emission (ρ) to points
- How do we assign opacity (α) to points?
- Scalar value
- Gradient magnitude
- How do we assign emission (ρ) to points?
- Scalar value
- Illumination
35
Transfer function - opacity
- Opacity (α)
- Scalar value
- Gradient magnitude
- Large gradients indicate change of material
∆ ∆ − − ∆ + ∆ ∆ − − ∆ + ∆ ∆ − − ∆ + = z 2 ) z z , y , x ( f ) z z , y , x ( f y 2 ) z , y y , x ( f ) z , y y , x ( f x 2 ) z , y , x x ( f ) z , y , x x ( f ) z , y , x ( G
36
Transfer function - emission
- Emission (ρ)
- Scalar value to color (I or RGB)
37
Illumination
- Include lighting effects
- Emission (ρ) depends on illumination
= ) z , y , x ( g ) z , y , x ( g N L
( ) ∑ ⋅ + ⋅ + = ρ
i n i s i d i a a
) R V ( k ) L N ( k I I k
V is the direction of the specular reflection
38
Illumination
39
Volume visualization
- Intermixing volume rendering and surface rendering
- Get the best from both techniques in the same picture
- Volume rendering
(bone)
- Surface rendering
(skin)
- Clipping
40
Assignment
- Volume rendering
- Rendering not to generate image
- Rendering to generate structured point datasets
41
Assignment
- Create 6 images (structured point datasets)
- For each side of dataset
(xmin, xmax, ymin, ymax, zmin, zmax)
- Do same volume rendering projections on each side
- Use parallel projection
42
Assignment
- Use uniform sampling
- Step size Δt equal to distance between nodes
- No interpolation needed; use node values
- (If accuracy not sufficient: use 0.5 Δt)
Δt
43
Example max projection x-min
// generate scalar field to store results .. for (int j = 0; j < dims[1]; j++) { // y-direction for (int k = 0; k < dims[2]; k++) { // z-direction double max = 0.0; for (int i = 0; i < dims[0]; i++) { // projection (ray) max = Math.max(max, scalars.getScalar(i, j, k)); } // store max value in scalar field .. } }
44
Assignment
- Experiment with the projection types
- Experiment with transfer functions
- Use of scalars and gradients to compute opacity
- Use different colors for different objects
- Experiment with illumination, clipping, ..
- Reminder:
− − + − − + − − + = 2 ) 1 k , j , i ( D ) 1 k , j , i ( D 2 ) k , 1 j , i ( D ) k , 1 j , i ( D 2 ) k , j , 1 i ( D ) k , j , 1 i ( D ) k , j , i ( G
45