visualisatie
play

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


  1. Visualisatie BMT Volume visualization Arjan Kok a.j.f.kok@tue.nl 1

  2. Lecture overview • Transparency • Volume rendering • Assignment 2

  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 3

  4. Transparency • Compositing R s G s B s A s • R = A s R s + (1 – A s ) R b • G = A s G s + (1 – A s ) G b • B = A s B s + (1 – A s ) B b RGBA R b G b B b A b • A = A s + (1 – A s ) A b • 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 4

  5. Transparency (0.8, 0, 0, 0.5) (0, 0.8, 0, 0.5) (0, 0, 0.8, 0.5) (0.4, 0.2, 0.1, 0.875) (0, 0.4, 0.2, 0.75) (0, 0, 0.4, 0.5) (0, 0, 0, 0) (0, 0, 0, 0) (0, 0.4, 0, 0.5) (0.2, 0.4, 0, 0.75) (0.1, 0.2, 0.4, 0.875) We have to sort the obj from back to front and then render them in that order !! 5

  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.4, 0.0, 0.2, 0. 75) (0.3, 0.2, 0.175, 0.875) (0, 0, 0.4, 0.5) (0, 0, 0, 0) C s = (0.4, 0, 0.2, 0.75) C b = (0, 0.8, 0, 0.5) 6

  7. Surface Graphics • Traditionally, graphics objects are modeled with surface primitives ( surface graphics ). • Continuous in object space 7

  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 8

  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 9

  10. Volume Graphics & Surface Graphics 10

  11. Volume Graphics Applications (simulation data set) • Scientific data set visualization 11

  12. More Volume Graphics Applications (artistic data set) • Amorphous entity visualization • smoke, steam, fire 12

  13. Volume visualization • Surface rendering • Volume rendering • Shows surfaces at • Shows continuous discrete values (iso- fields in 3D values) • Enables to see through the data • Data is seen more directly; less likely to miss details 13

  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) 14

  15. Ray Traversal Schemes • 15

  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) Base plane image plane 16 volume

  17. Image-order volume rendering 17

  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 18

  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 } 19

  20. Image-order volume rendering 20

  21. Image-order volume rendering • Interpolation function 21

  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) image plane 22 volume

  23. Object-order volume rendering 23

  24. Volume rendering Volume rendering methods • Image-order • Object-order • Projection types (ray functions) • Maximum intensity projection • Average projection • Distance projection • Transparency projections (compositing) 24

  25. Maximum intensity projection • Image pixel is set to maximum sample value along ray • Simple(st) • Provides intuitive understanding of data • No depth cues 25

  26. Average projection • Image pixel is set to average value along ray • Simple • Provides less intuitive understanding of data • No depth cues 26

  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 27

  28. Projections 28

  29. Transparency projections • Goal of visualization • Classification of objects • Selection of objects • Volume classification can be done by transfer functions 29

  30. Drebin, et. al. Original CT Data Fat Tissue Bone Density Color and Opacity Strength Gradient Transformed NX Shaded NY Final Image NZ 30

  31. Transparency projections • Basic model: (we want to understand structure !!) • Each point in the volume transmits and emits light t • Opacity and emission along ray: • Opacity: α(t) • Emission: ρ(t) 31

  32. Transparency projections • Back-to-front • Alpha-compositing I bg ρ = = α ( 0 = • and ( t ) I ( t ) I t ) 1 0 0 bg = α ρ + − I ( t ) ( t ) ( t ) ( 1 a ( t )) I ( t ) 1 1 1 1 0 = α ρ + − I ( t ) ( t ) ( t ) ( 1 a ( t )) I ( t ) I pixel 2 2 2 2 1 = α ρ + − I ( t ) ( t ) ( t ) ( 1 a ( t )) I ( t ) − n n n n n 1 N N = ∑α ρ − α ∏ I ( t ) ( t ) ( 1 ( t )) N samples: pixel i i j = = + i 0 j i 1 32

  33. Transparency projection • Back to front • Front to back I = I 0 I = 0 T = 1 for i = 1 .. N do for i = N .. 1 do I = ρ i α i + (1- α i ) I I = I + ρ i α i T T = (1- α i ) T I = I + T I 0 33

  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 34

  35. Transfer function - opacity • Opacity (α) • Scalar value • Gradient magnitude • Large gradients indicate change of material  + ∆ − − ∆  f ( x x , y , z ) f ( x x , y , z )   ∆ 2 x   + ∆ − − ∆ f ( x , y y , z ) f ( x , y y , z )   = G ( x , y , z )   ∆ 2 y   + ∆ − − ∆ f ( x , y , z z ) f ( x , y , z z )    ∆  2 z 35

  36. Transfer function - emission • Emission (ρ) • Scalar value to color (I or RGB) 36

  37. Illumination • Include lighting effects • Emission (ρ) depends on illumination L   g ( x , y , z )   = N   g ( x , y , z )   ( ) n ρ = + ⋅ + ⋅ ∑ k I I k ( N L ) k ( V R ) a a i d i s i i V is the direction of the specular reflection 37

  38. Illumination 38

  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 39

  40. Assignment • Volume rendering • Rendering not to generate image • Rendering to generate structured point datasets 40

  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 41

  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 42

  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 .. } } 43

  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: + − −  D ( i 1 , j , k ) D ( i 1 , j , k )    2   + − − D ( i , j 1 , k ) D ( i , j 1 , k )   = G ( i , j , k )   2 + − −   D ( i , j , k 1 ) D ( i , j , k 1 )     2 44

  45. Questions 45

More recommend