volume rendering using graphics hardwarecis565/lectures/volume... · 2010. 11. 19. · 2. sample...
TRANSCRIPT
![Page 1: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/1.jpg)
Volume Renderingusing Graphics Hardware
Travis GorkinGPU Programming and Architecture, June 2009
![Page 2: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/2.jpg)
AgendaVolume Rendering Background
Volumetric DataOptical ModelAccumulation Equations
Volume Rendering on the CPURaymarching Algorithm
Volume Rendering on Graphics HardwareSlice-Based Volume RenderingStream Model for Volume Raycasting
Volume Rendering in CUDA
![Page 3: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/3.jpg)
Volume Rendering DefinitionGenerate 2D projection of 3D data setVisualization of medical and scientific dataRendering natural effects - fluids, smoke, fireDirect Volume Rendering (DVR)
Done without extracting any surface geometry
![Page 4: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/4.jpg)
Volumetric Data3D Data Set
Discretely sampled on regular grid in 3D space3D array of samples
Voxel – volume elementOne or more constant data valuesScalars – density, temperature, opacityVectors – color, normal, gradientSpatial coordinates determined by position in data structure
Trilinear interpolationLeverage graphics hardware
![Page 5: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/5.jpg)
Transfer FunctionMaps voxel data values to optical properties
Glorified color mapsEmphasize or classify features of interest in the dataPiecewise linear functions, Look-up tables, 1D, 2DGPU – simple shader functions, texture lookup tables
![Page 6: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/6.jpg)
Volume Rendering Optical ModelLight interacts with volume ‘particles’ through:
AbsorptionEmissionScattering
Sample volume along viewing raysAccumulate optical properties
![Page 7: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/7.jpg)
Volume Ray Marching1. Raycast – once per pixel2. Sample – uniform intervals along ray3. Interpolate – trilinear interpolate, apply transfer function4. Accumulate – integrate optical properties
![Page 8: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/8.jpg)
Ray Marching Accumulation EquationsAccumulation = IntegralColor
dsTCC ii∫∞
=0
Total Color = Accumulation (Sampled Colors x Sampled Transmissivities)
AT −=1Transmissivity = 1 - Opacity
![Page 9: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/9.jpg)
Ray Marching Accumulation EquationsDiscrete VersionsAccumulation = SumColor
Opacity
i
n
iiTCC ∑
=
=1
AT −=1Transmissivity = 1 - Opacity
)1(11∏=
−−=n
jjAA
)1(1
11∏∑−
==
−=i
jj
n
ii ACC
![Page 10: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/10.jpg)
CPU Based Volume RenderingRaycast and raymarch for each pixel in scene
Camera (eye) location:For Each Pixel
Look Direction:Cast Ray Along:Accumulate Color Along Line
Cx
n̂snxC ˆ+
![Page 11: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/11.jpg)
CPU Based Volume RenderingSequential ProcessMinutes or Hours per frameOptimizations
Space PartitioningEarly Ray Termination
![Page 12: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/12.jpg)
Volumetric ShadowsLight attenuated as passes through volume‘Deeper’ samples receive less illuminationSecond raymarch from sample point to light source
Accumulate illumination from sample’s point of viewSame accumulation equations
Precomputed Light TransmissivityPrecalculate illumination for each voxel centerTrilinearly interpolate at render timeView independent, scene/light source dependent
![Page 13: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/13.jpg)
GPU Based Volume RenderingGPU 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
![Page 14: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/14.jpg)
Slice-Based Volume Rendering (SBVR)No volumetric primitive in graphics APIProxy geometry - polygon primitives as slices through volumeTexture polygons with volumetric dataDraw slices in sorted order – back-to-frontUse fragment shader to perform compositing (blending)
![Page 15: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/15.jpg)
Volumetric DataVoxel data sent to GPU memory as
Stack of 2D textures3D texture
Leverage graphics pipeline
Instructions for setting up 3D texture in OpenGLhttp://gpwiki.org/index.php/OpenGL_3D_Textures
![Page 16: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/16.jpg)
Proxy GeometrySlices through 3D voxel data3D voxel data = 3D texture on GPUAssign texture coordinate to every slice vertex
CPU or vertex shader
![Page 17: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/17.jpg)
Proxy GeometryObject-Aligned Slices
Fast and simpleThree stacks of 2D textures – x, y, z principle directions
Texture stack swapped based on closest to viewpoint
![Page 18: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/18.jpg)
Proxy GeometryIssues with Object-Aligned Slices
3x memory consumption Data replicated along 3 principle directions
Change in viewpoint results in stack swapImage popping artifactsLag while downloading new textures
Sampling distance changes with viewpointIntensity variations as camera moves
![Page 19: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/19.jpg)
Proxy GeometryView-Aligned Slices
Slower, but more memory efficientConsistent sampling distance
![Page 20: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/20.jpg)
Proxy GeometryView-Aligned Slices Algorithm
Intersect slicing planes with bounding boxSort resulting vertices in (counter)clockwise orderConstruct polygon primitive from centroid as triangle fan
![Page 21: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/21.jpg)
Proxy GeometrySpherical Shells
Best replicates volume ray castingImpractical – complex proxy geometry
![Page 22: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/22.jpg)
Sliced-Based Volume Rendering Steps
![Page 23: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/23.jpg)
Rendering Proxy GeometryCompositing
Over operator – back-to-front order
Under operator – front-to-back order
1ˆ)1(ˆ+−+= iiii CACC
1ˆ)1(ˆ+−+= iiii AAAA
11ˆ)ˆ1(ˆ−− +−= iiii CCAC
11ˆ)ˆ1(ˆ−− +−= iiii AAAA
![Page 24: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/24.jpg)
Rendering Proxy GeometryCompositing = Color and Alpha Accumulation EquationsEasily implemented using hardware alpha blending
OverSource = 1Destination = 1 - Source Alpha
UnderSource = 1 - Destination AlphaDestination = 1
![Page 25: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/25.jpg)
Simple Volume Rendering Fragment Shadervoid 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
}
![Page 26: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/26.jpg)
Fragment Shader with Transfer Functionvoid 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
}
![Page 27: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/27.jpg)
Local IlluminationBlinn-Phong Shading Model
NsLdLa nhkInlkIkI )ˆˆ()ˆˆ( ⋅+⋅+=
Resulting = Ambient + Diffuse + Specular
![Page 28: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/28.jpg)
Local IlluminationBlinn-Phong Shading Model
Requires surface normal vectorWhats the normal vector of a voxel?
NsLdLa nhkInlkIkI )ˆˆ()ˆˆ( ⋅+⋅+=
Resulting = Ambient + Diffuse + Specular
![Page 29: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/29.jpg)
Local IlluminationBlinn-Phong Shading Model
Requires surface normal vectorWhats the normal vector of a voxel? GradientCentral differences between neighboring voxels
NsLdLa nhkInlkIkI )ˆˆ()ˆˆ( ⋅+⋅+=
Resulting = Ambient + Diffuse + Specular
xbackfront
xbottomtop
xleftrightIIgrad
2)(,
2)(,
2)()( −−−
=∇=
![Page 30: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/30.jpg)
Local IlluminationCompute on-the-fly within fragment shader
Requires 6 texture fetches per calculation
Precalculate on host and store in voxel dataRequires 4x texture memoryPack into 3D RGBA texture to send to GPU
![Page 31: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/31.jpg)
Local IlluminationImprove perception of depthAmplify surface structure
![Page 32: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/32.jpg)
Volumetric Shadows on GPULight attenuated from light’s point of viewCPU – Precomputed Light Transfer
Secondary raymarch from sample to light source
GPUTwo-pass algorithmModify proxy geometry slicingRender from both the eye and the light’s POV
Two different frame buffers
![Page 33: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/33.jpg)
Two Pass Volume Rendering with ShadowsSlice 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-backRender order for eye – (a) front-to-back
(b) back-to-front
![Page 34: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/34.jpg)
First Pass Render from eyeFragment shader
Look up light color from light buffer bound as textureMultiply material color * light color
![Page 35: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/35.jpg)
Second passRender from lightFragment shader
Only blend alpha values – light transmissivity
![Page 36: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/36.jpg)
Volumetric Shadows
![Page 37: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/37.jpg)
Scattering and TranslucencyGeneral scattering effects too complex for interactive renderingTranslucency result of scattering
Only need to consider incoming light from cone in direction of light source
![Page 38: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/38.jpg)
Scattering and TranslucencyBlurring operation
See GPU Gems Chap 39 for details
![Page 39: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/39.jpg)
Performance and LimitationsHuge amount of fragment/pixel operations
Texture accessLighting calculationBlending
Large memory usageProxy geometry3D textures
![Page 40: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/40.jpg)
Volume Raycasting on GPU“Acceleration Techniques for GPU-Based Volume Rendering”
Krugger and Westermann, 2003
Stream model taken from work in GPU RaytracingRaymarching implemented in fragment program
Cast rays of sight through volumeAccumulate color and opacityTerminate when opacity reaches threshold
![Page 41: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/41.jpg)
Volume Raycasting on GPUMulti-pass algorithmInitial passes
Precompute ray directions and lengths
Additional passesPerform raymarching in parallel for each pixelSplit up full raymarch to check for early termination
![Page 42: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/42.jpg)
Step 1: Ray Direction ComputationRay 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
![Page 43: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/43.jpg)
Step 1: Ray Direction ComputationSubtraction blend two texturesStore normalized direction – RGB componentsStore length – Alpha component
![Page 44: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/44.jpg)
Fragment Shader RaymarchingDIR[x][y] – ray direction texture
2D RGBA values
P – per-vertex float3 positions, front of volume bounding boxInterpolated for fragment shader by graphics pipeline
s – constant step sizeFloat value
d – total raymarched distance, s x #stepsFloat value
![Page 45: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/45.jpg)
Fragment Shader RaymarchingDIR[x][y] – ray direction texture
2D RGBA values
P – per-vertex float3 positions, front of volume bounding boxInterpolated for fragment shader by graphics pipeline
s – constant step sizeFloat value
d – total raymarched distance, s x #stepsFloat value
Parametric Ray Equation
r – 3D texture coordinates used to sample voxel data
]][[ yxDIRdPr ⋅+=
![Page 46: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/46.jpg)
Fragment Shader RaymarchingRay traversal procedure split into multiple passes
M steps along ray for each passAllows for early ray termination, optimization
Optical properties accumulated along M stepsSimple compositing/blending operationsColor 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 terminationCompare opacity to thresholdCheck for ray leaving bounding volume
![Page 47: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/47.jpg)
OptimizationsEarly Ray Termination
Compare accumulated opacity against threshold
Empty Space SkippingAdditional data structure encoding empty space in volumeOct-treeEncode measure of empty within 3D texture read from fragment shaderRaymarching fragment shader can modulate sampling distance based on empty space value
![Page 48: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/48.jpg)
Performance and LimitationsMore physically-based than slice-based volume rendering
Guarantees equal sampling distances
Does not incorporate volumetric shadowsReduced 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
![Page 49: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/49.jpg)
Volume Rendering in CUDANVIDIA CUDA SDK Code SamplesExample: Basic Volume Rendering using 3D Textureshttp://developer.download.nvidia.com/compute/cuda/sdk/website/samples.html#volumeRender
![Page 50: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/50.jpg)
Volume Rendering in CUDA3D 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
![Page 51: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/51.jpg)
Volume Rendering in CUDA“Volume Raycasting with CUDA”
Jusub Kim, Ph.D. Dissertation, Univeristy of Maryland, College Park, 2008http://creator75.googlepages.com/cuda
Stream model for raycasting implemented in CUDAEfficiently balance warps of threads and block sizes
Single instruction execution within warp of threadsAvoid memory conflicts with warps of threads
![Page 52: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/52.jpg)
AgendaVolume Rendering Background
Volumetric DataOptical ModelAccumulation Equations
Volume Rendering on the CPURaymarching Algorithm
Volume Rendering on Graphics HardwareSlice-Based Volume RenderingStream Model for Volume Raycasting
Volume Rendering in CUDA
![Page 53: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/53.jpg)
References“Chapter 39. Volume Rendering Techniques”, GPU Gems Volume 1, Ikits, Kniss, Lefohn, Hansen, 2003http://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 2003http://wwwcg.in.tum.de/Research/data/Publications/vis03-rc.pdf
3D Slicer: Volume Rendering with CUDAhttp://www.slicer.org/slicerWiki/index.php/Slicer3:Volume_Rendering_Wit
h_Cuda
![Page 54: Volume Rendering using Graphics Hardwarecis565/LECTURES/Volume... · 2010. 11. 19. · 2. Sample – uniform intervals along ray 3. Interpolate – trilinear interpolate, ... `GPU](https://reader035.vdocuments.us/reader035/viewer/2022071507/61278e7a7c2fbc7b207dff3d/html5/thumbnails/54.jpg)
References“Volume Raycasting with Cuda”, Jusub Kim, 2008http://creator75.googlepages.com/projectshttp://creator75.googlepages.com/cudachapter.pdf
“Production Volume Rendering”, Jerry Tessendorf, Slides presented at University of Pennsylvania, 2008“Real-Time Volume Graphics”, SIGGRAPH 2004http://old.vrvis.at/via/resources/course-volgraphics-2004/