290 likes | 495 Views
High-Quality Pre-Integrated Volume Rendering Using Hardware Accelerated Pixel Shading. Klaus Engel, Martin Kraus, Thomas Ertl Visualization and Interactive Systems Group University of Stuttgart, Germany. Siggraph/Eurographics Workshop on Graphics Hardware 2001. Motivation.
E N D
High-Quality Pre-Integrated Volume Rendering Using Hardware Accelerated Pixel Shading Klaus Engel, Martin Kraus, Thomas Ertl Visualization and Interactive Systems Group University of Stuttgart, Germany Siggraph/Eurographics Workshop on Graphics Hardware 2001
Motivation • Problems of texture-based volume graphics on PCs: • scientific visualization • limited quality • 3D textures not commonly available • pre-classification shading • computer games • high rasterization requirements => low performance • high texture memory requirements
Texture-based Volume Rendering 2D textures (axis-aligned slices) texturing (bilinearinterpolation) compositing (blending) 3D textures (view-aligned Slices) texturing (trilinearinterpolation) compositing (blending)
Volume Rendering Quality Improvement • Higher sampling rates: additional tri-linearly interpolated slices • 3D textures: • render additional slice polygons • 2D textures: • render intermediate slices using multi-texture approach(Rezk-Salama,Engel et al., GH2000) • But: • decreases rendering speed due to additional rasterization • many additional slices required even for low-resolution volumes • non-linear transfer functions: not sufficient to sample volume with the Nyquist frequency of scalar data
interpolation classification interpolation classification Volume Classification transfer functions Pre- classification voxels Post- classification
Pre-Integrated Volume Rendering • Our approach: • texture-based (2D/3D) • ray-segments computed in a pre-processing step • pre-computed ray-segment lookup (dependent texture) • small number of slices => fast • Especially suited for: • low resolution volume data • non-linear transfer functions • Capable of: • high-quality rendering • direct volume rendering, volume shading, isosurfaces
project slice sf sb texture polygon front slice back slice sb pre-integrate all possible combinations fetch integral from dependent texture sb sf sf sf sb Pre-integrated Volume Rendering - Idea slice-by-slice slab-by-slab hardware-accelerated implementation on NVidia GeForce3 chip
Texture Shaders • Texture Shaders (when enabled) replace the standard OpenGL texture fetch mechanism • With texture shaders, results from previous stages can affect the lookup of a subsequent stage ARB_multitexture only ARB_multitexture with NV_texture_shader unit 0fetch stage 0math & fetch (s,t,r,q)0 (s,t,r,q)0 unit 1fetch stage 1math & fetch (s,t,r,q)1 (s,t,r,q)1 unit 2fetch stage 2math & fetch (s,t,r,q)2 (s,t,r,q)2
stage 0 TEXTURE_2D (s0,t0) RGBA result sf sb RGB0 stage 1 TEXTURE_2D (s1,t1) RGBA result sb RGB1 stage 2 DOT_PRODUCT_NV (1,0,0)• RGB1=sb (s2,t2,r2) (1,0,0) stage 3 DOT_PRODUCT_TEXTURE2D_NV (1,0,0) • RGB0=sf sf RGBA result (s3,t3,r3) (1,0,0) on to register combiners Pre-integrated Volume Rendering - Texel Fetch front slice back slice
1. 2. 1 front slice back slice front slice back slice 4 3. 4. 3a 2 3 3a front slice back slice front slice back slice Isosurfaces Isosurfaces:particular dependent texture sb 96 32 sf 32 96
gb gf Isosurfaces – Gradient Interpolation • g = IP gb + (1-IP) gfinterpolation weight: IP = (siso – sf)/(sb – sf) • store gradient with scalar data in RGBA texture • store IP in dependent texture • implement interpolation in reg. combiners sb g front slice back slice
R R G G B B A A I = Ia + Id ( n.l ) + Is ( n.h )p Pre-integrated Volume Rendering – Register Combiners • Combiner 0+1: rebuild gradients (front + back) gx gy gz gy gz gx s s • Combiner 2: interpolate gradients IP = (siso – sf)/(sb – sf) g = IP gb + (1-IP) gf • Combiner 3-7: shading (isosurface or volume) pmax = 256
Interactive Transfer Function Update • 8 bit data: 256 x 256 = 65536 ray segments=> ~20 seconds on Athlon 650 (for constant ray segment length) • 3 optimizations: • assume constant ray segment length • local modification of TF requires local update of DT • neglect self-attenuation within ray-segments and use integral functions (as in Max et al., VolVis’90)
128 slices pre-classification 128 slices post-classification 284 slices post-classification 128 slices pre-integrated Results – Direct Volume Rendering
Results Performance • PCNvidia GeForce3 64 MB DDR SDRAM (3.8 ns), 200 MHz internal clock, 460 MHz memory clock, 512 x 512 viewport • 25 % slower than approach that used 1 or 2 texture fetches=> loopback in texture_shaders for 3rd and 4th fetch (2 clock cycles) • Interactive transfer function update when neglecting self-attenuation
Problems • artifacts in isosurfaces • unequal ray segment lengths • only linear interpolation for each ray segment • artifacts on volume boundaries • clipping planes front slice back slice
Conclusions • Pre-Integrated Volume Rendering • High quality • even for small volumes • with small number of slices • with non-linear transfer functions • reproduces high frequencies in the transfer function • Low rasterization requirements • Semi-transparent Volume Rendering • Volume Shading • Isosurfaces • arbitrary number • independently colored • per-pixel lighting
Demo Demo and Data Download:http://wwwvis.informatik.uni-stuttgart.de/~engel/pre-integrated/
R G B A Appendix: Volume Shading and Isosurfaces • Per-pixel shading requires per-voxel gradient or dot product • dynamic lighting • static lighting (fixed light sources) x y z voxel gradient voxel intensity L A dot product voxel intensity
R G B A Appendix: Gradient Rebuild • dot product affects only the RGB components • voxel intensity stored in R, • gradient in GBA y z x voxel intensity voxel gradient • Reroute x-component of gradient to R channel in the register combiners for lighting
const. color1 spare 1 Id prim. color Ia Is const. color0 sec. color I = Ia + Id ( n.l ) + Is ( n.h )p Appendix: Register Combiners GC3 GC4 GC5 GC6 GC7 FC input registers lighting RGB A h Id ( n.l ) + Is ( n.h )p A A A B B B AB AB AB A G dotproduct C C C const. 0 A A B D D D sum sum A• B B 1 l C AB+ (1-A)C +D AB+CD C 0 C• D D D D
Appendix: Dependent Texture Shaders • DEPENDENT_AR_-TEXTURE_2D_NV:The previous texture shader’s alpha and red colors are used as the (s,t) for a 2D texture lookup • not suitable for us, because we need (s,t) from two different textures stage 0 TEXTURE_2D GL_RGBA8internal format (s0,t0) on to texture environment or register combiners RGBA stage 1 DEPENDENT_AR_-TEXTURE_2D_NV nonprojective_lookup_2D( A, R ) Texture coordinates unused … RGBA result
Appendix: Results - Quality • Comparison: • pre-classification • post-classification • pre-integrated classification pre-integrated dependent texture post-classification dependent texture for tri-linear ip. intermediate slices sb asb sf (1-a)sf