Acceleration Techniques for GPUbased Volume Rendering J Krger
Acceleration Techniques for GPUbased Volume Rendering J. Krüger R. Westermann computer graphics & visualization Technical University Munich
Motivation Properties of real data sets Surface like structures Surface illumination Images courtesy of Joe Kniss and volren. org Occlusions computer graphics & visualization
Motivation Texture based volume rendering today: Hardware accelerated rendering of totally invisible structures only 2% of all fragments visible computer graphics & visualization
Our Contribution We use new GPU Features to: • Discard invisible fragments • early ray termination • empty space skipping • Implement a high quality GPU Raycaster • Accelerate the Raycaster computer graphics & visualization
Our Toolkit Programmable graphics hardware • “Arbitrarily” programmable shaders • Assembly language • High level languages • 32 Bit-Floating-point processing • • • Input: fp 32 textures Arithmetic: fp 24 -fp 32 Output: fp 32 render targets • Early Z-Test • Multiple dependent texture fetches computer graphics & visualization
Our Toolkit Stream Architecture Geometry Rasterizer Fragments User Textures … Early Z-Test … Fragment Shader … Render Texture computer graphics & visualization
Raycaster Slicing (SBVR) vs. GPU-Raycaster (RC) SBVR render proxy geometry (slices) RC render proxy geometry (faces) computer graphics & visualization
Raycasting Using only one main pass for Raymarching computer graphics & visualization
Basic Idea Multi-pass approach • Generate entry point • first hit in local texture coordinates • Compute ray direction • ray direction in local texture coordinates • Ray Marcher (simplified) • Main pass (Ray traversal) • Intermediate pass (Stopping criterion) computer graphics & visualization
Entry Point • Render into 2 D texture • Front faces of the volume bounding box • Texture coordinates as color components (0, 1, 0) (1, 1, 1) (0, 0, 1) (1, 0, 0) (1, 0, 1) computer graphics & visualization
Ray Direction • render into second texture • back faces of the bounding box • subtract from entry-point texture to get ray direction (0, 1, 0) (1, 1, 1) (0, 0, 0) (0, 0, 1) subtract (1, 0, 0) (1, 0, 1) (0, 0, 1) (1, 0, 0) (1, 0, 1) computer graphics & visualization
Basic Idea Multi-pass approach • Generate entry point • first hit in local texture coordinates • Compute ray direction • ray direction in local texture coordinates • Ray Marcher • Main passes (Ray traversal) • Intermediate pass (Stopping criterion) computer graphics & visualization
Raycasting Using multiple Raymarching passes computer graphics & visualization
Ray Marcher (Main passes) We know: Entry pointand ray direction Render front-faces • set Color like before • set Texture coords to NDC • activate direction texture • a global counter C (x, y) DIR t compute ray as: r(t)=C+t*DIR(x, y) float 3 f. Direction = tex 2 D(s. Direction, v. Tex. Coords. rg). rgb ; float 3 f. Front. Val = v. Color. rgb; float 3 f. Vol. Coord = f. Front. Val+f. Depth*f. Direction ; computer graphics & visualization
Ray Marcher (Main passes) Integration along the ray • • • use r(t) to access the volume integrate over multiple steps (N) combine with frame buffer contents [. . ] for (int i=0; i<N; i++) { f. Result. Val = under(tex 3 D(s. Volume, f. Vol. Coord), f. Result. Val ); f. Vol. Coord += f. Step. Size*f. Direction ; } return f. Result. Val ; computer graphics & visualization
Raycasting Acceleration techniques Raycasting Early Ray Empty Space Termination Skipping computer graphics & visualization
Acceleration Techniques Terminate Rays on one of the following conditions: • it has left the volume • it has reached a certain opacity Suspend a ray if: • it‘s traversing an empty region this needs to be done on a per-fragment basis early Z-Test computer graphics & visualization
Acceleration techniques Early-Z Restrictions: • on current GPUs early Z-Test only works if • no clip or texkill operation is executed • the Z-value is not changed in the shader the raymarching shader can not terminate himself • Solution: use intermediate pass to do the raysuspending/terminating computer graphics & visualization
Acceleration techniques • Execute intermediate pass after every main pass (= N volume samples) • Access z-value only in this pass • If ray is terminated or suspended set z-value before main-pass-geometry • Reset depth behind it if ray is to be resumed computer graphics & visualization
Ray Marcher (intermediate pass) for early ray termination alpha for empty space skipping : check accumulated : check “skip-volume” Skip volume: • volume sampled down to 1/8 in every dimension • every sample contains the minimum and maximum of the 512 corresponding entries Check Texture: • 2 D lookup texture • lookup(x, y)=1 iff all values between x and y are 0 under the current transfer function computer graphics & visualization
Ray Marcher (intermediate pass) for early ray termination alpha for empty space skipping float 4 f. Last. Val float 3 f. Direction float 3 f. Front. Val float 3 f. Vol. Coord float 2 f. Max. Min float f. Empty : check accumulated : check “skip-volume” = tex 2 D(s. Last. Frame, v. Tex. Coords. rg ); = tex 2 D(s. Direction, v. Tex. Coords. rg). rgb ; = v. Color. rgb; = f. Front. Val+f. Depth*f. Direction ; = tex 3 D(s. Empty. Space, f. Vol. Coord). rg ; = tex 2 D(s. Empty. Look. Up, f. Max. Min); OUT. depth = ((f. Last. Val. a< 0. 9999) && (f. Empty<1)) ? 0 : 100; OUT. col = f. Last. Val; return OUT; computer graphics & visualization
DEMOS Run on • Intel Pentium IV 2. 4 GHz • ATI Radeon 9800 Pro. • Microsoft Windows XP • Direct. X 9 • Pixel/Vertex Shader 2. 0 computer graphics & visualization
Iso-Surface Raycasting • first 2 passes and intermediate passes remain unchanged • global traversal order still front to back • order within the main shader is back to front • keep only last isovalue • if isovalue was found compute illumination with 3 D gradient texture and write it to the final image computer graphics & visualization
Conclusion Using current GPU features we showed how to • Discard invisible fragments • early ray termination • empty space skipping • Implement a high quality GPU Raycaster • Accelerate that Raycaster computer graphics & visualization
The End Thank you! Questions? Download Slides at: http: //wwwcg. in. tum. de/Research/Publications/Raycast/ computer graphics & visualization
- Slides: 25