Volume Rendering using Graphics Hardware

Slides:



Advertisements
Similar presentations
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
Advertisements

VIS Group, University of Stuttgart Tutorial T4: Programmable Graphics Hardware for Interactive Visualization Pre-Integrated Splatting (Stefan Roettger)
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
Direct Volume Rendering. What is volume rendering? Accumulate information along 1 dimension line through volume.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Other DVR Algorithms and A Comparison Jian Huang, CS 594, Spring 2002.
Ray-casting in VolumePro™ 1000
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
1 Computer Graphics Chapter 9 Rendering. [9]-2RM Rendering Three dimensional object rendering is the set of collective processes which make the object.
The Discrete Ray-casting Algorithm Qiang Xue Jiaoying Shi State Key Lab Of CAD&CG Zhejiang University.
Hank Childs, University of Oregon November 15 th, 2013 Volume Rendering, Part 2.
Volume Rendering Volume Modeling Volume Rendering Volume Modeling Volume Rendering 20 Apr
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Information Visualization.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
Splatting Josh Anon Advanced Graphics 1/29/02. Types of Rendering Algorithms Backward mapping Image plane mapped into data Ray casting Forward mapping.
Introduction to Volume Rendering Presented by Zvi Devir.
High-Quality Volume Graphics on Consumer PC Hardware
(conventional Cartesian reference system)
Direct Volume Rendering Joe Michael Kniss Scientific Computing and Imaging Institute University of Utah.
Skin Rendering GPU Graphics Gary J. Katz University of Pennsylvania CIS 665 Adapted from David Gosselin’s Power Point and article, Real-time skin rendering,
3D Graphics Processor Architecture Victor Moya. PhD Project Research on architecture improvements for future Graphic Processor Units (GPUs). Research.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Ray Tracing and Photon Mapping on GPUs Tim PurcellStanford / NVIDIA.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
19/18/ :34 Graphics II Volume Rendering Session 10.
REAL-TIME VOLUME GRAPHICS Markus Hadwiger VRVis Research Center, Vienna Eurographics 2006 Real-Time Volume Graphics [04] GPU-Based Ray-Casting.
Lecture 3 : Direct Volume Rendering Bong-Soo Sohn School of Computer Science and Engineering Chung-Ang University Acknowledgement : Han-Wei Shen Lecture.
Interactive Rendering of Meso-structure Surface Details using Semi-transparent 3D Textures Vision, Modeling, Visualization Erlangen, Germany November 16-18,
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
-Global Illumination Techniques
Scientific Visualization Module 6 Volumetric Algorithms (adapted by S.V. Moore – slides deleted, modified, and added) prof. dr. Alexandru (Alex) Telea.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Real-time visualization of large detailed volumes on GPU Cyril Crassin, Fabrice Neyret, Sylvain Lefebvre INRIA Rhône-Alpes / Grenoble Universities Interactive.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
Shader Study 이동현. Vision engine   Games Helldorado The Show Warlord.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
3D Volume Visualization. Volume Graphics  Maintains a 3D image representation that is close to the underlying fully-3D object (but discrete)  경계표면 (Boundary.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Motivation Properties of real data sets Surface like structures
Volume Visualization with Ray Casting
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Hardware Accelerated Volume Rendering Using PC Hardware CSE564 Final Demo Evan Closson.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
Hardware-Accelerated Parallel Non-Photorealistic Volume Rendering Eric B.Lum Kwan-Liu Ma University of California at Davis.
Graphics Processing Unit
Deferred Lighting.
3D Graphics Rendering PPT By Ricardo Veguilla.
Volume Rendering Lecture 21.
GPU Graphics Gary J. Katz University of Pennsylvania CIS 665
Real-Time Volume Graphics [06] Local Volume Illumination
Volume Rendering Lecture 21.
Presentation transcript:

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

Agenda Volume Rendering Background Volume Rendering on the CPU 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 Voxel – volume element 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 Voxel Data Density Temperature Optical Properties Color Opacity

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

Volume Ray Marching Raycast – once per pixel Sample – uniform intervals along ray Interpolate – trilinear interpolate, apply transfer function Accumulate – integrate optical properties

Ray Marching Accumulation Equations Accumulation = Integral Color Transmissivity = 1 - Opacity Total Color = Accumulation (Sampled Colors x Sampled Transmissivities)

Ray Marching Accumulation Equations Discrete Versions Accumulation = Sum Color Opacity Transmissivity = 1 - Opacity

CPU Based Volume Rendering Raycast and raymarch for each pixel in scene Camera (eye) location: For Each Pixel Look Direction: Cast Ray Along: 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

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 Resulting = Ambient + Diffuse + Specular

Local Illumination Blinn-Phong Shading Model Requires surface normal vector Whats the normal vector of a voxel? Resulting = Ambient + Diffuse + Specular

Local Illumination Blinn-Phong Shading Model Requires surface normal vector Whats the normal vector of a voxel? Gradient Central differences between neighboring voxels Resulting = Ambient + Diffuse + Specular

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 Voxel Data X Gradient Y Gradient Z Gradient Value 3D Texture R G B A

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

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 Parametric Ray Equation 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 Empty Space Skipping 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 slice- based 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 non- opaque 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 Volume Rendering on the CPU 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/