Texture-based Volume Rendering Texture Mapping � Volume rendering by ray casting is time- � Modern graphics hardware includes facility to draw a consuming textured polygon � one ray per pixel � The texture is an image with � each ray involves tracking through volume red, green, blue and alpha calculating samples, and then compositing components… � … so several overlapping � different for each viewpoint polygons can be composited � Alternative approach - using texture maps - can exploit graphics hardware 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 72 73 Texture-based Volume Rendering Texture-based Volume Rendering � Draw from back-to-front a set of � For a given viewing direction, volume we would need to select slices rectangles perpendicular to this direction � first rectangle drawn as an area of coloured � This requires interpolation to pixels, with associated opacity, as determined get the values on the slices by transfer function and interpolation - and � Only expensive 3D texture merged with background in a compositing hardware can do this fast image operation (supported by hardware) enough… plane � successive rectangles drawn on top 3D texture mapping 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 74 75 Texture-based Volume Rendering Texture Mapping � Simpler solution - 2D texture mapping: � view volume as set of slices parallel to co- ordinate planes + Textured-mapped 2D image 2D polygon polygon choose the orientation best suited to viewing direction 5/12/2003 R. Crawfis, Ohio State Univ. 76 5/12/2003 R. Crawfis, Ohio State Univ. 77 1
Texture Mapping (2) Tex. Mapping for Volume Rendering (0,1) (1,1) Remember ray casting … (0,0.5) (0.5,0.5) (0,0) (0.5,0) (0,0) (1,0) y assign the texture coordinates Each texel has 2D to each polygon to establish z coordinates assigned the mapping to it. 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 78 79 Texture based volume rendering Texture based volume rendering z y x • Render each xz slice in the volume as a texture-mapped polygon • The texture contains RGBA (color and opacity) • The polygons are drawn from back to front 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 80 81 Changing Viewing Direction Changing View Direction (2) Until … You are not going to see anything What if we change the viewing position? this way … y y That is okay, we just change the eye position x This is because the view direction now is x (or rotate the polygons Parallel to the slice planes and re-render), What do we do? Until … 5/12/2003 R. Crawfis, Ohio State Univ. 82 5/12/2003 R. Crawfis, Ohio State Univ. 83 2
Switch Slicing Planes Some Considerations… (5) When do we need to change the slicing orientation? y What do we do? x y • Change the orientation of slicing planes x • Now the slice polygons are parallel to YZ plane in the object space When the major component of view vector changes from y to -x 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 84 85 Some Considerations… (6) Three copies of data needed Major component of view vector? •We need to reorganize the input textures for diff. View directions. • Reorganize the textures on the fly is too time consuming. We want Given the view vector (x,y,z) -> get the maximal component to prepare the texture sets beforehand If x: then the slicing planes are parallel to yz plane If y: then the slicing planes are parallel to xz plane If z: then the slicing planes are parallel to xy plane z -> This is called (object-space) axis-aligned method. y x xz slices yz slices xy slices 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 86 87 Problem (1) Texture based volume rendering Algorithm: (using 2D texture mapping hardware) � Non-even sampling rate Turn off the depth test; Enable blending For (each slice from back to front) { - Load the 2D slice of data into texture memory - Create a polygon corresponding to the slice d d’ d’’ - Assign texture coordinates to four corners of the polygon - Render and blend the polygon (use OpenGL alpha blending) to the frame buffer d’’ > d’ > d Sampling artifact will become visible } 5/12/2003 R. Crawfis, Ohio State Univ. 88 5/12/2003 R. Crawfis, Ohio State Univ. 89 3
Problem (2) Solution (1) Object-space axis-aligned method can create artifacts: � Insert intermediate slides to maintain Popping Effect the sampling rate y x d d’ d’’ There is a sudden change of slicing direction when the view vector transitions from one major direction to another. The change in the image intensity can be quite visible 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 90 91 3D Texture Based Volume Rendering Solution (2) Use Image-space axis-aligned slicing plane: the slicing planes are always parallel to the view plane 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 92 93 Slice-Interpolated Volume 3D Texture Mapping Rendering Arbitrary slicing through the volume and texture color mapping capabilities are needed opacity - Arbitrary slicing polygon: this can be computed using software in real time This is basically polygon-volume clipping Similar to raycasting with object (color, opacity) simultaneous rays 1.0 5/12/2003 R. Crawfis, Ohio State Univ. 94 5/12/2003 R. Crawfis, Ohio State Univ. 95 4
3D Texture Mapping Solid (3D) Texture Mapping Texture mapping to the arbitrary slices Now the input texture space is 3D (0,1,1) (1,1,1) Texture coordinates: (r,s,t) This requires 3D texture mapping harware (0,1,0) (1,1,0) Input texture: volume (pre-classified and shaded) (r2,s2,t2) (r3,s3,t3) essentially an (R,G,B, α ) volume Depending on the position of the polygon, (0,0,0) (1,0,0) appropriate textures are resampled, constructed and mapped to the polygon. (r1,s1,t1) (r0,s0,t0) 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 96 97 Slice Based Rendering Slice Based Rendering Image plane View 1 slice direction Eye Slices Slices Graphics Hardware 5 slices Volume Data • Polygons – Proxy geometry • Textures – Data & interpolation • Blending operations – Numerical integration 20 slices 45 slices 85 slices 170 slices 5/12/2003 R. Crawfis, Ohio State Univ. 5/12/2003 R. Crawfis, Ohio State Univ. 98 99 Slice Based Problems? Lighting and Shading � Does not perform correct � 3D texture mapping with hardware tricks to achieve lighting is becoming feasible. � Illumination � Accumulation - but can get close � Can not easily add correct illumination and shadowing � See the Van Gelder paper for their addition for illumination ⌧ Stored in LUT quantized normal vector directions � See Kniss papers (Utah) for use of vertex shaders and new hardware to solve many of these problems. C. Lao, OSU 5/12/2003 R. Crawfis, Ohio State Univ. 100 5/12/2003 R. Crawfis, Ohio State Univ. 101 5
Pros and Cons Advantages : - Fast with volume sizes that the hardware can take e.g. 2 fps for 256 cube volumes - No popping effect Disadvantages: - Need to compute the slicing planes for every view angle - only supported on high end hardware - low quality without per-pixel classification shading and classification (i.e. post-classification and shading) Both 2D or 3D hardware texture mapping methods can not compute shading on the fly. The input textures have to be pre-shaded. With multi-texturing functions, per-pixel shading and classification are becoming possible. 5/12/2003 R. Crawfis, Ohio State Univ. 102 6
Recommend
More recommend