Real-Time Volume Graphics

54
Klaus Engel Siemens Corporate Research Princeton Aaron E. Lefohn Center for Image Processing and Integrated Computing University of California, Davis Markus Hadwiger VR VIS Research Center Vienna, Austria Christof Rezk Salama Computer Graphics and Multimedia Group University of Siegen, Germany Joe M. Kniss Scientific Computing and Imaging Insitute, University of Utah Daniel Weiskopf Visualization and Interactive Systems Group, University of Stuttgart, Germany Real-Time Volume Graphics

description

Real-Time Volume Graphics. Pre-Integration and High-Quality Filtering. This is what we want …. But often this is what we get …. Framebuffer. Filtering. Classification. Shading. Integration. Sampling. Volume Rendering Artifacts. Volume Rendering Pipeline Where are errors introduced ?. - PowerPoint PPT Presentation

Transcript of Real-Time Volume Graphics

Page 1: Real-Time Volume Graphics

Klaus EngelSiemens Corporate ResearchPrinceton

Aaron E. LefohnCenter for Image Processing and Integrated ComputingUniversity of California, Davis

Markus HadwigerVR VIS Research CenterVienna, Austria

Christof Rezk SalamaComputer Graphics andMultimedia GroupUniversity of Siegen, Germany

Joe M. KnissScientific Computing and Imaging Insitute,University of Utah

Daniel WeiskopfVisualization and Interactive Systems Group,University of Stuttgart, Germany

Real-Time Volume Graphics

Page 2: Real-Time Volume Graphics

Klaus EngelSiemens Corporate ResearchPrinceton

Aaron E. LefohnCenter for Image Processing and Integrated ComputingUniversity of California, Davis

Markus HadwigerVR VIS Research CenterVienna, Austria

Christof Rezk SalamaComputer Graphics andMultimedia GroupUniversity of Siegen, Germany

Joe M. KnissScientific Computing and Imaging Insitute,University of Utah

Daniel WeiskopfVisualization and Interactive Systems Group,University of Stuttgart, Germany

Real Time Volume Graphics

Pre-Integration and High-Quality Filtering

Page 3: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

This is what we want …

Page 4: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

But often this is what we get …

Page 5: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Volume Rendering Artifacts

Volume Rendering PipelineWhere are errors introduced ?

Low sampling

rate

Linear

filtering

High

frequencies

8 bit

blending

Integration

Quantized

Gradients

Framebuffer

Sampling

Filtering Classification Shading

Page 6: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Sampling Artifacts

Page 7: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Reason:Low sampling rate

Solutions:Increase sampling rate to Nyquist frequency => at least 2 samples per voxel

Adaptive SamplingHigher sampling rate where data contains high frequencies

Sampling Artifacts128 Samples284 Samples

Page 8: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Sampling Artifacts

Remove woodgrain artifact by stochastic jittering of ray-start position

Look-up noise texture to offset ray-position in view direction

Page 9: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts

643 volume, object-aligned slices

bi-linear filter bi-cubic filter

Page 10: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering ArtifactsReason:

Internal filtering precision dependent on input texture formatLinear filters do not approximate the ideal reconstruction filter (sinc-Filter) very well

Solutions:Use internal format with higher precisionImplement a HQ filter in a fragment program

Page 11: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filters

Discretized version of convolution integral

g(x) = f[x] * h(x)f[x]

discrete signalh(x)

filterconvolution

Filter width: 2m

Page 12: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filters

Procedural evaluation of kernel and convolutionTexture-based kernel and convolution

FetchInputSamples();ComputeWeights_X();for (i=0; i<3; i++) Convolution_X();ComputeWeights_Y();Convolution_Y();

see for example NVIDIA’sBicubicTexMagnification demo

pre-sampled B-spline kernelfrom [Hadwiger et al. 2001]

Page 13: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filters

Procedural evaluation of kernel and convolutionTexture-based kernel and convolution

FetchInputSamples();ComputeWeights_X();for (i=0; i<3; i++) Convolution_X();ComputeWeights_Y();Convolution_Y();

t0

t1

t2

t3

R G B A

pre-sampled B-spline kernelfrom [Hadwiger et al. 2001]

see for example NVIDIA’sBicubicTexMagnification demo

Page 14: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filters

Transform original kernel into look-up texture

Replicate kernel tile over output grid

kernel tile

Page 15: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filters

Easy when kernel separable

Use same 1D kernel tile for all axesSample two (or three) timesand multiply weights

Separable bi-cubic andtri-cubic filters need onlyone 1D RGBA kernel tile

Page 16: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filters

Distribution instead of gatheringWorks for all filter shapes and sizesWorks for separable and non-separable kernelsMulti-pass evaluation of filter convolution sum

Page 17: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filters

Tri-cubic gradients and second derivatives for isosurfaces possible in real-time!

Page 18: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filterslinear cubic

Page 19: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Filtering Artifacts / HQ-Filterslinear cubic

Page 20: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Classification ArtifactsPre-Classification

Post-Classification

Pre-Integrated-Classification

Filtering Classification

FilteringClassification

Filtering Integral LookupPre-Integration

……

Page 21: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Classification Artifacts

High frequencies in the transfer function T increase required sampling rate

x

s(x)

s

T(s)

x

T(s(x))

Page 22: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Classification Artifacts

multiple peaks

50 x more slices

s

T(s)

Page 23: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Reason:Classification can add high frequencies to rendered data

Solution:Pre-Integrated Classification=> split numerical integration into

one pre-integration for the TFone integration for the scalar field

slab-by-slab rendering

Classification Artifacts / Pre-integration

Page 24: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

image-order

object-order

slice-by-slice slab-by-slab

sample-by-sample raySegment-by-raySegment

Classification Artifacts / Pre-integration

Page 25: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Screen

Slab

Eyesf

sb

Classification Artifacts / Pre-integration

Page 26: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Pre-Integration of allpossible combinations

save valuesIn table

sf

sb

sbsf

Pre-processing

Classification Artifacts / Pre-integration

Page 27: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

project back slice

sf sb

front slice

back slice

Rendering

Classification Artifacts / Pre-integration

Page 28: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

// define inputs from applicationstruct appin{ float4 Position : POSITION; float4 Normal : NORMAL; float4 TCoords0 : TEXCOORD0;};// define outputs from vertex shaderstruct vertout{ float4 HPosition : POSITION; float4 TCoords0 : TEXCOORD0; float4 TCoords1 : TEXCOORD1;};vertout main(appin IN, uniform float4x4 ModelViewProj,// model-view-projection matrix uniform float4x4 ModelViewI, // inverse of the modelview matrix uniform float4x4 TexMatrix, //Texture matrix for texture 0 uniform float SamplingDistance

)

Cg Vertex Program

Classification Artifacts / Pre-integration

Page 29: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

{vertout OUT;

OUT.TCoords0 = mul(TexMatrix, IN.TCoords0);

// transform view pos vec and view dir to obj spacefloat4 vPosition = mul(ModelViewI, float4(0,0,0,1));float4 vDir = normalize(mul(ModelViewI, float4(0.f,0.f,-1.f,1.f)));

//compute position of virtual back vertexfloat4 eyeToVert = normalize(IN.Position - vPosition);float4 backVert = {1,1,1,1};backVert = IN.Position - eyeToVert * (SamplingDistance / dot(vDir,eyeToVert));

//compute texture coordinates for virtual back vertexOUT.TCoords1 = mul(TexMatrix, backVert); // transform vertex position into homogenous clip-spaceOUT.HPosition = mul(ModelViewProj, IN.Position);return OUT;

}

Cg Vertex Program

Classification Artifacts / Pre-integration

Page 30: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

sf sb

slice

utilize sf and sb as texture coordinates forthe dependent texture

sf

sb

fetch sf and sb duringrasterization

Rendering

Classification Artifacts / Pre-integration

Page 31: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

sf sb

slice

fetch pre-integratedray-segment

sf

sb

texture polygon withpre-integrated value

Rendering

Page 32: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

struct v2f_simple { float4 Hposition : POSITION; float3 TexCoord0 : TEXCOORD0; float3 TexCoord1 : TEXCOORD1;float4 Color0 : COLOR0;};

float4 main(v2f_simple IN, uniform sampler3D Volume, uniform sampler2D TransferFunction, uniform sampler2D PreIntegrationTable) : COLOR{ float4 lookup; //sample front scalar lookup.x = tex3D(Volume, IN.TexCoord0.xyz).x; //sample back scalar lookup.y = tex3D(Volume, IN.TexCoord1.xyz).x;

//lookup and return pre-integrated value return tex2D(PreIntegrationTable, lookup.yx);}

Cg Fragment Program

Classification Artifacts / Pre-integration

Page 33: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Pre-integration table to large12bit x 12bit x RGBA8 = 4096x4096x32bit = 64MB

Pre-integration table to slow to computeeven with integral functions

Solution: use Integral functionsStore integral functions in 1D floating point texturetwo 1D table lookups

Classification Artifacts / Pre-integration

Page 34: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Almost no performance penalty in sw raycasting

Cache last scalar value

Currently slower on graphics hardwareTemporary fragment registers are zeroedTwo lookups into the volume per fragment

=> multiple integration steps @ once (raycasting)

Pre-integrated volume rendering still not “correct”

Assumes linear progression of scalar value along ray=> Gaussian Transfer Functions (Kniss Vis’03)

Classification Artifacts / Pre-integration

Page 35: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

128 slicespre-

classification

128 slicespre-integrated

284 slicespost-

classification

128 slicespost-

classification

Classification Artifacts / Pre-integration

Page 36: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

single step

Classification Artifacts / Pre-integration

Page 37: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

multiple peaks

Classification Artifacts / Pre-integration

Page 38: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

many peaks

Classification Artifacts / Pre-integration

Page 39: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

acoustic volumeinside car cabine

Classification Artifacts / Pre-integration

Page 40: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

homogeneousregion

inhomogeneousregion

Classification Artifacts / Pre-integration

Page 41: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Shading Artifacts

Page 42: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Shading ArtifactsReasons:

Gradients are pre-computed and quantizedInterpolation of normals causes unnormalized normals

Solutions:Store gradients in high-precision texture,re-normalize in fragment program too much memory

Compute gradients on-the-fly high-quality gradientmany texture fetches

Sobel gradient

Page 43: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Shading Artifacts

Add offset to texture coordinate of fragment// samples for forward differences

half3 normal;half3 sample1;sample1.x = (half)tex3D(Volume, IN.TexCoord0+offset.xwww).x;sample1.y = (half)tex3D(Volume, IN.TexCoord0+offset.wyww).x;sample1.z = (half)tex3D(Volume, IN.TexCoord0+offset.wwzw).x;

// additional samples for central differenceshalf3 sample2;sample2.x = (half)tex3D(Volume, IN.TexCoord0-offset.xwww).x;sample2.y = (half)tex3D(Volume, IN.TexCoord0-offset.wyww).x;sample2.z = (half)tex3D(Volume, IN.TexCoord0-offset.wwzw).x;

// compute central differences gradientnormal = normalize(sample2.xyz – sample1.xyz);

Cg Fragment Program

Page 44: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Shading Artifacts

Pass in shifted texture coordinates// samples for forward differenceshalf3 normal;half3 sample1;sample1.x = (half)tex3D(Volume, IN.TexCoord2).x;sample1.y = (half)tex3D(Volume, IN.TexCoord4).x;sample1.z = (half)tex3D(Volume, IN.TexCoord6).x;

// additional samples for central differenceshalf3 sample2;sample2.x = (half)tex3D(Volume, IN.TexCoord3).x;sample2.y = (half)tex3D(Volume, IN.TexCoord5).x;sample2.z = (half)tex3D(Volume, IN.TexCoord7).x;

// compute central differences gradientnormal = normalize(sample2.xyz – sample1.xyz);

Cg Fragment Program

Page 45: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending Artifacts

8 bit

fixed point

blending

16 bit

floating point

blending

32 bit

floating point

blending

Page 46: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending ArtifactsReason:

8 bit blending accumulates error in the framebuffer

Solutions:Blending into a floating point pbufferNv4x support 16 bit floating point blendingNv3x, R3xx and R4xx do not support floating point blending=> implement blending in a fragment programPing-pong blending to prevent read/write race conditions

Page 47: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending Artifacts

The graphics hardware does not support floating point blending (NV3x, R3xx, R4xx)=> implement blending yourselfClean: ping-pong

Blend

A B

Page 48: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending Artifacts

The graphics hardware does not support floating point blending (NV3x, R3xx, R4xx)=> implement blending yourselfClean: ping-pong

Blend

A B

Page 49: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending Artifacts

The graphics hardware does not support floating point blending (NV3x, R3xx, R4xx)=> implement blending yourselfClean: ping-pong

Blend

A B

Page 50: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending Artifacts

The graphics hardware does not support floating point blending (NV3x, R3xx, R4xx)=> implement blending yourselfDirty: ping without the pong

Blend

A B

Page 51: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending Artifacts

The graphics hardware does not support floating point blending (NV3x, R3xx, R4xx)=> implement blending yourselfDirty: ping without the pong

Blend

A

Page 52: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Blending Artifacts

The graphics hardware does not support floating point blending (NV3x, R3xx, R4xx)=> implement blending yourselfDirty: ping without the pong

Blend

A

Page 53: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Conclusions

Artifacts are introduced in various stages of the volume rendering process

Current graphics hardware is flexible and precise enough to remove or suppress artifacts

Real-Time performance can still be achieved in most cases

Page 54: Real-Time Volume Graphics

REAL-TIME VOLUME GRAPHICSKlaus Engel, Siemens Corporate Research, Princeton, USA

Questions?

Thank you!

Acknowledgements:NVIDIA and ATI for the demo hardware

For some of the images and figures:Joe Michael KnissMarkus Hadwiger