Transcript ray-casting

Memory Efficient and Robust Software Implementation of the Raycast Algorithm Aline Pina

COPPE/UFRJ Rio de Janeiro - Brazil

[email protected]

Cristiana Bentes

DESC/UERJ Rio de Janeiro - Brazil

[email protected]

Ricardo Farias

COPPE/UFRJ Rio de Janeiro - Brazil

[email protected]

WSCG 2007

Outline

• • • • •

Volume Visualization Ray-casting Proposed Ray-casting Algorithms Experimental Results Conclusions

Volume Visualization

• • •

Volumetric data

3D data

2D plane images Gains:

Understanding

Visual analysis and interpretation

Volumetric Data

Generated:

Simulation (Fluid Dynamic)

Sensors (CT scanner)

Measured Data (Ocean Buoys)

Represented:

3D grid of voxels (Regular or Irregular)

Volume Visualization Methods Surface Rendering x Volume Rendering

Discard data between surfaces

Object is semi-transparent

Loses information

Hides internal structures

Faster to compute

More information

Shows internal structures

Computational intensive

Volume Rendering Algorithms

Cell projection: cells are projected on the screen

Ray-casting: rays are casted through every pixel

Ray-casting

Ray-casting - History

First software implementation:

Garrity(1990) - cell connectivity

Improvement:

Bunyk(1998) - entry points + new auxiliary structures

Ray-casting - History

Problems:

Auxiliary data structures - high memory consumption

Degenerate cases

Our Goal

Improvements in Bunyk approach:

Completely handle degenerate cases

Smaller data structures

Deal with tetrahedral and/or hexahedral grids

Ray-casting Algorithms

ME-Raycast Memory Efficient Ray-casting

EME-Raycast Enhanced Memory Efficient Ray-casting

ME-Raycast

ME-Raycast

Data Structures

Points array

Cells array

Use_set for each vertex

Neighbor_set for each cell

Faces array – on-the-fly

ME-Raycast

Use_set(v)

List of all cells incident on v

Use_set(v) = {A, B, C, D, E} E A

v

D B C 2D example

ME-Raycast

Neighbor_set(c)

List of all cells that share a face with c

A 2D example

ME-Raycast

Neighbor_set(c)

List of all cells that share a face with c

Neighbor_set(A) = {B, C, D} B A C D 2D example

ME-Raycast

Faces array

List of all faces intersected by the rays

3D example

ME-Raycast

Faces array

List of all faces intersected by the rays

3D example

ME-Raycast

Faces array

List of all faces intersected by the rays

Faces array A 3D example

ME-Raycast

Faces array

List of all faces intersected by the rays

B Faces array A B 3D example

ME-Raycast

Faces array

List of all faces intersected by the rays

B Faces array A B 3D example

ME-Raycast

Algorithm

Preprocessing:

Read data – create arrays Points and Cells

Create Use_set

Create Neighbor_set

ME-Raycast

Algorithm

Raycasting:

Project visible faces – entry point

For each pixel:

Find next intersection – check other cell's faces

If (no intersection) – check degenerate cases

Accumulate color and opacity

EME-Raycast

EME-Raycast

Data Structures

Points array

Cells array

Use_set for each vertice

Neighbor_set for each cell

Faces array

EME-Raycast

Algorithm

Verification of intersection:

Checking the face - recalculate parameters

Handling Degeneracies

Handling Degeneracies

Ray hits a vertex

a 2D example

Handling Degeneracies

Ray hits a vertex Bunyk check

a A b E 2D example

Handling Degeneracies

Ray hits a vertex Our check

a A b B C E D 2D example

Handling Degeneracies

Ray hits a vertex

a A b B C E D c 2D example

Handling Degeneracies

Ray hits an edge

3D example

Handling Degeneracies

Ray hits an edge

a 3D example

Handling Degeneracies

Ray hits an edge

a b 3D example

Handling Degeneracies

Ray hits an edge

a b 3D example

Handling Degeneracies

Ray hits an edge Bunyk check

a b 3D example

Handling Degeneracies

Ray hits an edge Our check

a b c 3D example

Experimental Results

Experimental Results Workload Datasets Blunt Fin Combustion Chamber Oxygen Post SPX Delta Wing Hexa # Cells 187 395 215 040 513 375 827 904 1 005 675 1 920

Experimental Results

Baselines:

Bunyk (ray-casting)

ZSweep (cell projection)

Step 1

Bunyk Algorithm

Viewing Direction

Screen

Step 2

Bunyk Algorithm

Viewing Direction

Screen

ZSweep Algorithm

Z Target Z Sweep Direction

v

P t X P Pixel List

Z Target Z

ZSweep Algorithm

t

v

P X P Pixel List

Experimental Results Degenerate cases: Blunt Comb Oxygen 512 2 10 11 1024 2 31 2 38 Delta 7 17 SPX 5 18 Pixels not rendered

Experimental Results Memory Consumption ME-Raycast – 1024 x 1024 image Blunt Combustion Oxygen Delta SPX Bunyk 75% 76% 66% 61% 74% ZSweep 40% 76% 70% 152% 222%

Experimental Results Memory Consumption EME-Raycast – 1024 x 1024 image Blunt Combustion Oxygen Delta SPX Bunyk 39% 37% 30% 27% 27% ZSweep 20% 37% 30% 68% 83%

Experimental Results Execution Time ME-Raycast – 1024 x 1024 image Blunt Combustion Oxygen Delta SPX Bunyk 126% 106% 136% 148% 116% ZSweep 29% 38% 38% 33% 41%

Experimental Results Execution Time EME-Raycast – 1024 x 1024 image Blunt Combustion Oxygen Delta SPX Bunyk 304% 224% 289% 271% 222% ZSweep 70% 80% 82% 61% 79%

Conclusions

• • • •

Two memory-aware ray-casting algorithms Improved Bunyk work: memory, degenerate cases, handling hexahedral Significant gains in memory usage Correct images

Future Work

• • •

Software out-of-core version GPU implementation Parallelization

Thank you!

[email protected]