8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray...

29
8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches

Transcript of 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray...

Page 1: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.1Vis_04

Data VisualizationData Visualization

Lecture 83D Scalar Visualization

Volume Rendering : Further Ray Casting plus Other

Approaches

Page 2: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.2Vis_04

Classical Approach - Volume Rendering Integral

Classical Approach - Volume Rendering Integral

Cast rays through image plane into volume, and measure light received

– Kajiya and von Hertzen (1984)

– Max (1995) L

s

I = L0C(s)(s) exp[ -s

0 (t)dt ] ds

C(s)=light reflectedat point s

(s) = density atpoint s

lightdensity attenuation

imageplane

volume

Page 3: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.3Vis_04

Simplifying the IntegralSimplifying the Integral

Approximate using Riemann sums (n = number of steps)

Approximate exponential by Taylor series and introduce opacity, , and unit spacing

Calculate recursively front-to-back as...

I = L0C(s)(s) exp[ -s

0 (t)dt ] ds

I = ni=0 C(is)(is)s

i-1j=0 exp [- (js)s]

I = ni=0 C(i)(i) i-1

j=0 (1 - (j))

Cout = Cin + (1-in)iCi

out = in + i(1 - in)

Compositing associative but not commutativeie can group but cannot re-order

{stop when = 1}

Page 4: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.4Vis_04

InterpolationInterpolation

Sample points occur within cells, not at grid points, so we need to interpolate

Do we:– classify at grid

points, then interpolate colour / opacity

– interpolate data values, then classify

– ?

Classify - interpolate

– classification done as pre-processing

– smoothing effect can obscure detail

Interpolate - classify– classification now

within the inner loop of the ray cast (sample points are view dependent)

– in return, fine detail can be picked out

Page 5: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.5Vis_04

Classify - InterpolateClassify - Interpolate

There is a danger in interpolation after classification

Naïve colour interpolation would assign 3 parts yellow, 1 part blue to centre point…

… but if opacity of bottomleft is zero?

Correct approach is toweight according to opacity,so colour at centre is yellow!

=1 =1

=1=0

Page 6: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.6Vis_04

A Note on ShadingA Note on Shading

The appearance of volume rendered images depends critically on the reflectance calculation used to shade the samples...

Page 7: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.7Vis_04

A Note on ShadingA Note on Shading

At (xi,yj,zk), df/dx = 0.5*(f i+1,j,k - f i-1,j,k) df/dy = 0.5*(f i,j+1,k - f i,j-1,k) df/dz = 0.5*(f i,j,k+1 - f i,j,k-1)

This gives us normals at all grid points

Recall from isosurface rendering - that surface normal is equal to the gradient vector of f

Page 8: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.8Vis_04

A Note on ShadingA Note on Shading

If the classification is done at the vertices, there is a choice:– Gouraud-type: shade vertices and

then interpolate to get reflected colour at sample point

– Phong-type: interpolate normals at vertices to get sample normal and then calculate shading

Phong-type gives better quality - at the cost of more computational effort

Page 9: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.9Vis_04

Ray CastingRay Casting

Advantages– Non binary

classification– Shows structure

between surfaces– Readily parallelisable

Disadvantages– Computationally

expensive - cost proportional to number of voxels (compositing is expensive)

– Does not take advantage of triangle rendering hardware

Page 10: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.10Vis_04

Ray Casting ExamplesRay Casting Examples

The following sequence of slides were produced using the ray casting technique available in the vtk software

The slides show for the bonsai tree data set how different aspects can be highlighted by control of the opacity transfer

The slides also show, by animation, a comparison of different approaches to interpolation and shading

Thanks to Chris Goodyer for creating the images

Page 11: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.11Vis_04

LegendLegend

NN = classify vertex, shade, nearest neighbour interpolate

Trilin Vertex = classify vertex, trilinear interpolate, shade

Trilin Sample = trilinear interpolate, classify, shade

Page 12: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.12Vis_04

Bonsai TreeNN – TrilinVertex –

TrilinSample

Bonsai TreeNN – TrilinVertex –

TrilinSample

NN TrilinVertex

TrilinSample

Page 13: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.13Vis_04

Bonsai Tree BranchesNN – TrilinVertex -

TrilinSample

Bonsai Tree BranchesNN – TrilinVertex -

TrilinSample

Page 14: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.14Vis_04

Bonsai Tree LeavesNN – TrilinVertex -

TrilinSample

Bonsai Tree LeavesNN – TrilinVertex -

TrilinSample

Page 15: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.15Vis_04

SkullNN – TrilinVertex -

TrilinSample

SkullNN – TrilinVertex -

TrilinSample

Page 16: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.16Vis_04

Texture-based Volume Rendering

Texture-based Volume Rendering

Volume rendering by ray casting is time-consuming– one ray per pixel– each ray involves tracking through

volume calculating samples, and then compositing

– different for each viewpoint Alternative approach - using

texture maps - can exploit graphics hardware

Page 17: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.17Vis_04

Texture MappingTexture Mapping

Modern graphics hardware includes facility to draw a textured polygon

The texture is an image with red, green, blue and alpha components…

… this is used in computer graphics to avoid constructing complex geometric models

… and we can exploit this in volume rendering

Page 18: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.18Vis_04

Texture-based Volume Rendering

Texture-based Volume Rendering

Draw from back-to-front a set of rectangles– first rectangle drawn as an area of

coloured pixels, with associated opacity, as determined by transfer function and interpolation - and merged with background in a compositing operation (supported by hardware)

– successive rectangles drawn on top

Page 19: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.19Vis_04

3D Texture-based Volume Rendering

3D Texture-based Volume Rendering

For a given viewing direction, we would need to select slices perpendicular to this direction

This requires interpolation to get the values on the slices

Until recently this has only been possible with expensive graphics boards

imageplane

volume

3D texture mapping

Page 20: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.20Vis_04

2D Texture-based Volume Rendering

2D Texture-based Volume Rendering

Simpler solution - 2D texture mapping:– view volume as set of slices parallel

to co-ordinate planes

-Precompute the textured planes for each of the 3 directions-Choose the orientation best suited to viewing direction

Page 21: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.21Vis_04

Texture-based Volume Rendering

Texture-based Volume Rendering

Page 22: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.22Vis_04

Comparison of Ray Casting and Texture Approaches

Comparison of Ray Casting and Texture Approaches

Ray casting Ray castingTexture-based Texture-based

http://www.cora.nwra.com/Ogle/

http://vg.swan.ac.uk/vlib

http://www.amiravis.com

Page 23: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.23Vis_04

Close UpClose Up

Ogle: texture-based Vlib: ray casting

Page 24: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.24Vis_04

Shear Warp RenderingShear Warp Rendering

To get fast traversal, shear volume by translating each slice… then can resample as shown

Project front-to-back to get intermediate image

Then warp image

Page 25: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.25Vis_04

Example of Shear Warp Rendering

Example of Shear Warp Rendering

Page 26: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.26Vis_04

New Hardware AdvancesNew Hardware Advances

Holy grail: real-time volume rendering

Main searcher has been Kaufman through Cube architectures

VolumePro System first commercially available from Mitsubishi’s RealTime Visualization, now from TeraRecon

Uses shear-warp rendering

http://www.rtviz.com/home.html

Page 27: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.27Vis_04

SplattingSplatting

Another commonly used method is splatting

Fuzzy balls around each voxel projected on to image plane

Composited in the image plane

VolumeToGeom in IRIS Explorer

Page 28: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.28Vis_04

Summary of Volume Rendering TechniquesSummary of Volume

Rendering Techniques

Ray casting Splatting

– Both high quality, computationally expensive

Texture-based Shear-warp

– Both lower quality, but faster

Page 29: 8.1 Vis_04 Data Visualization Lecture 8 3D Scalar Visualization Volume Rendering : Further Ray Casting plus Other Approaches.

8.29Vis_04

ReadingReading Overviews of Volume Visualization

– Todd Elvins, `A Survey of Algorithms for Volume Visualization’, Computer Graphics, 1992

– Ken Brodlie and Jason Wood, Computer Graphics Forum, 2001

– Michael Meissner et al, ‘A Practical Evaluation of Popular Volume Rendering Algorithms’,

http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/volvis2000.pdf

Ray Casting - Classic Paper– Marc Levoy, `Display of Surfaces from Volume

Data’, IEEE CG&A, 1988 Book

– Introduction to Volume Rendering, Lichtenbelt, Crane, Naqvi, Hewlett-Packard Professional Books