Volume Rendering using Graphics Hardware. Travis Gorkin GPU Programming and Architecture, June 2009

Similar documents
Interactive Level-Set Deformation On the GPU

Volume Rendering on Mobile Devices. Mika Pesonen

Overview Motivation and applications Challenges. Dynamic Volume Computation and Visualization on the GPU. GPU feature requests Conclusions

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Hardware design for ray tracing

Interactive Level-Set Segmentation on the GPU

GPU Architecture. Michael Doggett ATI

INTRODUCTION TO RENDERING TECHNIQUES

Practical Volume Rendering in mobile devices

Volume visualization I Elvins

Modern Graphics Engine Design. Sim Dietrich NVIDIA Corporation

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

The Future Of Animation Is Games

Computer Graphics Hardware An Overview

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

Introduction to Computer Graphics

NVIDIA IndeX Enabling Interactive and Scalable Visualization for Large Data Marc Nienhaus, NVIDIA IndeX Engineering Manager and Chief Architect

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Image Synthesis. Transparency. computer graphics & visualization

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

Optimizing AAA Games for Mobile Platforms

Direct Volume Rendering Elvins

GPU Point List Generation through Histogram Pyramids

Lezione 4: Grafica 3D*(II)

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

CUBE-MAP DATA STRUCTURE FOR INTERACTIVE GLOBAL ILLUMINATION COMPUTATION IN DYNAMIC DIFFUSE ENVIRONMENTS

Data Centric Interactive Visualization of Very Large Data

High Dynamic Range and other Fun Shader Tricks. Simon Green

Employing Complex GPU Data Structures for the Interactive Visualization of Adaptive Mesh Refinement Data

OpenGL Performance Tuning

A Short Introduction to Computer Graphics

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

Introduction GPU Hardware GPU Computing Today GPU Computing Example Outlook Summary. GPU Computing. Numerical Simulation - from Models to Software

REAL-TIME IMAGE BASED LIGHTING FOR OUTDOOR AUGMENTED REALITY UNDER DYNAMICALLY CHANGING ILLUMINATION CONDITIONS

GPU Shading and Rendering: Introduction & Graphics Hardware

Interactive 3D Medical Visualization: A Parallel Approach to Surface Rendering 3D Medical Data

Graphics Cards and Graphics Processing Units. Ben Johnstone Russ Martin November 15, 2011

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Introduction to GPGPU. Tiziano Diamanti

Real-Time Realistic Rendering. Michael Doggett Docent Department of Computer Science Lund university

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

HistoPyramid stream compaction and expansion

Deferred Shading & Screen Space Effects

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

Making natural looking Volumetric Clouds In Blender 2.48a

Outline. srgb DX9, DX10, XBox 360. Tone Mapping. Motion Blur

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

Data Visualization Using Hardware Accelerated Spline Interpolation

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

Writing Applications for the GPU Using the RapidMind Development Platform

Image Synthesis. Fur Rendering. computer graphics & visualization

Facts about Visualization Pipelines, applicable to VisIt and ParaView

GPUs Under the Hood. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

An introduction to Global Illumination. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Radeon HD 2900 and Geometry Generation. Michael Doggett

Introduction to GPU Programming Languages

Flame On: Real-Time Fire Simulation for Video Games. Simon Green, NVIDIA Christopher Horvath, Pixar

Performance Optimization and Debug Tools for mobile games with PlayCanvas

Touchstone -A Fresh Approach to Multimedia for the PC

Visualization and Feature Extraction, FLOW Spring School 2016 Prof. Dr. Tino Weinkauf. Flow Visualization. Image-Based Methods (integration-based)

Dhiren Bhatia Carnegie Mellon University

Image Based Rendering With Stable Frame Rates

Interactive Computer Graphics

3D Computer Games History and Technology

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

CAUSTICS are complex patterns of shimmering

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Rendering Microgeometry with Volumetric Precomputed Radiance Transfer

GPU for Scientific Computing. -Ali Saleh

ANDROID DEVELOPER TOOLS TRAINING GTC Sébastien Dominé, NVIDIA

NVIDIA IndeX. Whitepaper. Document version June 2013

GPGPU Computing. Yong Cao

3D Math Overview and 3D Graphics Foundations

Real-time Visual Tracker by Stream Processing

Petascale Visualization: Approaches and Initial Results

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

Advanced Rendering for Engineering & Styling

GPGPU: General-Purpose Computation on GPUs

Lecture Notes, CEng 477

Interactive Visualization of Magnetic Fields

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

Equalizer. Parallel OpenGL Application Framework. Stefan Eilemann, Eyescale Software GmbH

Cork Education and Training Board. Programme Module for. 3 Dimensional Computer Graphics. Leading to. Level 5 FETAC

Data Visualization Study at Earth Simulator Center

Parallel 3D Image Segmentation of Large Data Sets on a GPU Cluster

Medical Image Processing on the GPU. Past, Present and Future. Anders Eklund, PhD Virginia Tech Carilion Research Institute

NVFX : A NEW SCENE AND MATERIAL EFFECT FRAMEWORK FOR OPENGL AND DIRECTX. TRISTAN LORACH Senior Devtech Engineer SIGGRAPH 2013

QCD as a Video Game?

Transcription:

Volume Rendering using Graphics Hardware Travis Gorkin GPU Programming and Architecture, June 2009

Agenda Volume Rendering Background Volumetric Data Optical Model Accumulation Equations Volume Rendering on the CPU Raymarching Algorithm Volume Rendering on Graphics Hardware Slice-Based Volume Rendering Stream Model for Volume Raycasting Volume Rendering in CUDA

Volume Rendering Definition Generate 2D projection of 3D data set Visualization of medical and scientific data Rendering natural effects - fluids, smoke, fire Direct Volume Rendering (DVR) Done without extracting any surface geometry

Volumetric Data 3D Data Set Discretely sampled on regular grid in 3D space 3D array of samples Voxel volume element One or more constant data values Scalars density, temperature, opacity Vectors color, normal, gradient Spatial coordinates determined by position in data structure Trilinear interpolation Leverage graphics hardware

Transfer Function Maps voxel data values to optical properties Glorified color maps Emphasize or classify features of interest in the data Piecewise linear functions, Look-up tables, 1D, 2D GPU simple shader functions, texture lookup tables

Volume Rendering Optical Model Light interacts with volume particles through: Absorption Emission Scattering Sample volume along viewing rays Accumulate optical properties

Volume Ray Marching 1. Raycast once per pixel 2. Sample uniform intervals along ray 3. Interpolate trilinear interpolate, apply transfer function 4. Accumulate integrate optical properties

Ray Marching Accumulation Equations Accumulation = Integral Color C = 0 C i T i ds Transmissivity = 1 - Opacity T =1 A Total Color = Accumulation (Sampled Colors x Sampled Transmissivities)

Ray Marching Accumulation Equations Discrete Versions Accumulation = Sum Color Opacity n C = C i T A = 1 i= 1 n j= 1 i (1 A j ) Transmissivity = 1 - Opacity T =1 A C = n i 1 i= 1 j= 1 C i (1 A j )

CPU Based Volume Rendering Raycast and raymarch for each pixel in scene Camera (eye) location: For Each Pixel Look Direction: Cast Ray Along: nˆ x C + ns ˆ x C Accumulate Color Along Line

CPU Based Volume Rendering Sequential Process Minutes or Hours per frame Optimizations Space Partitioning Early Ray Termination

Volumetric Shadows Light attenuated as passes through volume Deeper samples receive less illumination Second raymarch from sample point to light source Accumulate illumination from sample s point of view Same accumulation equations Precomputed Light Transmissivity Precalculate illumination for each voxel center Trilinearly interpolate at render time View independent, scene/light source dependent

GPU Based Volume Rendering GPU Gems Volume 1: Chapter 39 Volume Rendering Techniques Milan Ikits, Joe Kniss, Aaron Lefohn, Charles Hansen IEEE Visualization 2003 Tutorial Interactive Visualization of Volumetric Data on Consumer PC Hardware Acceleration Techniques for GPU-Based Volume Rendering J. Krugger and R. Westermann, IEEE Visualization 2003

Slice-Based Volume Rendering (SBVR) No volumetric primitive in graphics API Proxy geometry - polygon primitives as slices through volume Texture polygons with volumetric data Draw slices in sorted order back-to-front Use fragment shader to perform compositing (blending)

Volumetric Data Voxel data sent to GPU memory as Stack of 2D textures 3D texture Leverage graphics pipeline Instructions for setting up 3D texture in OpenGL http://gpwiki.org/index.php/opengl_3d_textures

Proxy Geometry Slices through 3D voxel data 3D voxel data = 3D texture on GPU Assign texture coordinate to every slice vertex CPU or vertex shader

Proxy Geometry Object-Aligned Slices Fast and simple Three stacks of 2D textures x, y, z principle directions Texture stack swapped based on closest to viewpoint

Proxy Geometry Issues with Object-Aligned Slices 3x memory consumption Data replicated along 3 principle directions Change in viewpoint results in stack swap Image popping artifacts Lag while downloading new textures Sampling distance changes with viewpoint Intensity variations as camera moves

Proxy Geometry View-Aligned Slices Slower, but more memory efficient Consistent sampling distance

Proxy Geometry View-Aligned Slices Algorithm Intersect slicing planes with bounding box Sort resulting vertices in (counter)clockwise order Construct polygon primitive from centroid as triangle fan

Proxy Geometry Spherical Shells Best replicates volume ray casting Impractical complex proxy geometry

Sliced-Based Volume Rendering Steps

Rendering Proxy Geometry Compositing Over operator back-to-front order Under operator front-to-back order 1 ˆ ) (1 ˆ + + = i i i i C A C C 1 ˆ ) (1 ˆ + + = i i i i A A A A 1 1 ˆ ) ˆ (1 ˆ + = i i i i C C A C 1 1 ˆ ) ˆ (1 ˆ + = i i i i A A A A

Rendering Proxy Geometry Compositing = Color and Alpha Accumulation Equations Easily implemented using hardware alpha blending Over Source = 1 Destination = 1 - Source Alpha Under Source = 1 - Destination Alpha Destination = 1

Simple Volume Rendering Fragment Shader void main( { } uniform float3 emissivecolor, uniform sampler3d datatex, float3 texcoord : TEXCOORD0, float4 color : COLOR) float a = tex3d(texcoord, datatex); // Read 3D data texture color = a * emissivecolor; // Multiply by opac

Fragment Shader with Transfer Function void main( { } ) uniform sampler3d datatex, uniform sampler1d tftex, float3 texcoord : TEXCOORD0, float4 color : COLOR float v = tex3d(texcoord, datatex); // Read 3D data color = tex1d(v, tftex); // transfer function

Local Illumination Blinn-Phong Shading Model I = k + I k ( lˆ nˆ) + I k ( hˆ nˆ ) a L d Resulting = Ambient + Diffuse + Specular L s N

Local Illumination Blinn-Phong Shading Model I = k + I k ( lˆ nˆ) + I k ( hˆ nˆ ) a Requires surface normal vector L Whats the normal vector of a voxel? d Resulting = Ambient + Diffuse + Specular L s N

Local Illumination Blinn-Phong Shading Model I = k + I k ( lˆ nˆ) + I k ( hˆ nˆ ) a Requires surface normal vector L d Resulting = Ambient + Diffuse + Specular Whats the normal vector of a voxel? Gradient Central differences between neighboring voxels L s N grad( I) = I = ( right left) 2x, ( top bottom) 2x, ( front back) 2x

Local Illumination Compute on-the-fly within fragment shader Requires 6 texture fetches per calculation Precalculate on host and store in voxel data Requires 4x texture memory Pack into 3D RGBA texture to send to GPU

Local Illumination Improve perception of depth Amplify surface structure

Volumetric Shadows on GPU Light attenuated from light s point of view CPU Precomputed Light Transfer Secondary raymarch from sample to light source GPU Two-pass algorithm Modify proxy geometry slicing Render from both the eye and the light s POV Two different frame buffers

Two Pass Volume Rendering with Shadows Slice axis set half-way between view and light directions Allows each slice to be rendered from eye and light POV Render order for light front-to-back Render order for eye (a) front-to-back (b) back-to-front

First Pass Render from eye Fragment shader Look up light color from light buffer bound as texture Multiply material color * light color

Second pass Render from light Fragment shader Only blend alpha values light transmissivity

Volumetric Shadows

Scattering and Translucency General scattering effects too complex for interactive rendering Translucency result of scattering Only need to consider incoming light from cone in direction of light source

Scattering and Translucency Blurring operation See GPU Gems Chap 39 for details

Performance and Limitations Huge amount of fragment/pixel operations Texture access Lighting calculation Blending Large memory usage Proxy geometry 3D textures

Volume Raycasting on GPU Acceleration Techniques for GPU-Based Volume Rendering Krugger and Westermann, 2003 Stream model taken from work in GPU Raytracing Raymarching implemented in fragment program Cast rays of sight through volume Accumulate color and opacity Terminate when opacity reaches threshold

Volume Raycasting on GPU Multi-pass algorithm Initial passes Precompute ray directions and lengths Additional passes Perform raymarching in parallel for each pixel Split up full raymarch to check for early termination

Step 1: Ray Direction Computation Ray direction computed for each pixel Stored in 2D texture for use in later steps Pass 1: Front faces of volume bounding box Pass 2: Back faces of volume bounding box Vertex color components encode object-space principle directions

Step 1: Ray Direction Computation Subtraction blend two textures Store normalized direction RGB components Store length Alpha component

Fragment Shader Raymarching DIR[x][y] ray direction texture 2D RGBA values P per-vertex float3 positions, front of volume bounding box Interpolated for fragment shader by graphics pipeline s constant step size Float value d total raymarched distance, s x #steps Float value

Fragment Shader Raymarching DIR[x][y] ray direction texture 2D RGBA values P per-vertex float3 positions, front of volume bounding box Interpolated for fragment shader by graphics pipeline s constant step size Float value d total raymarched distance, s x #steps Float value Parametric Ray Equation r = P + d DIR[ x][ y] r 3D texture coordinates used to sample voxel data

Fragment Shader Raymarching Ray traversal procedure split into multiple passes M steps along ray for each pass Allows for early ray termination, optimization Optical properties accumulated along M steps Simple compositing/blending operations Color and alpha(opacity) Accumulation result for M steps blended into 2D result texture Stores overall accumlated values between multiple passes Intermediate Pass checks for early termination Compare opacity to threshold Check for ray leaving bounding volume

Optimizations Early Ray Termination Compare accumulated opacity against threshold Empty Space Skipping Additional data structure encoding empty space in volume Oct-tree Encode measure of empty within 3D texture read from fragment shader Raymarching fragment shader can modulate sampling distance based on empty space value

Performance and Limitations More physically-based than slicebased volume rendering Guarantees equal sampling distances Does not incorporate volumetric shadows Reduced number of fragment operations Fragment programs made more complex Optimizations work best for nonopaque data sets Early ray termination and empty space skipping can be applied

Volume Rendering in CUDA NVIDIA CUDA SDK Code Samples Example: Basic Volume Rendering using 3D Textures http://developer.download.nvidia.com/compute/cuda/sdk/websi te/samples.html#volumerender

Volume Rendering in CUDA 3D Slicer www.slicer.org Open source software for visualization and image analysis Funded by NIH, medical imaging, MRI data Currently integrating CUDA volume rendering into Slicer 3.2

Volume Rendering in CUDA Volume Raycasting with CUDA Jusub Kim, Ph.D. Dissertation, Univeristy of Maryland, College Park, 2008 http://creator75.googlepages.co m/cuda Stream model for raycasting implemented in CUDA Efficiently balance warps of threads and block sizes Single instruction execution within warp of threads Avoid memory conflicts with warps of threads

Agenda Volume Rendering Background Volumetric Data Optical Model Accumulation Equations Volume Rendering on the CPU Raymarching Algorithm Volume Rendering on Graphics Hardware Slice-Based Volume Rendering Stream Model for Volume Raycasting Volume Rendering in CUDA

References Chapter 39. Volume Rendering Techniques, GPU Gems Volume 1, Ikits, Kniss, Lefohn, Hansen, 2003 http://http.developer.nvidia.com/gpugems/gpugems_ch39.html Interactive Visualization of Volumetric Data on Consumer PC Hardware IEEE Visualization 2003 Tutorial http://www.vis.uni-stuttgart.de/vis03_tutorial/ Acceleration Techniques for GPU-Based Volume Rendering J. Krugger and R. Westermann, IEEE Visualization 2003 http://wwwcg.in.tum.de/research/data/publications/vis03-rc.pdf 3D Slicer: Volume Rendering with CUDA http://www.slicer.org/slicerwiki/index.php/slicer3:volume_rendering_wit h_cuda

References Volume Raycasting with Cuda, Jusub Kim, 2008 http://creator75.googlepages.com/projects http://creator75.googlepages.com/cudachapter.pdf Production Volume Rendering, Jerry Tessendorf, Slides presented at University of Pennsylvania, 2008 Real-Time Volume Graphics, SIGGRAPH 2004 http://old.vrvis.at/via/resources/course-volgraphics-2004/