The Discrete Ray-casting Algorithm Qiang Xue Jiaoying Shi State Key Lab Of CAD&CG Zhejiang...

30
The Discrete Ray- casting Algorithm Qiang Xue Jiaoying Shi State Key Lab Of CAD&CG Zhejiang University

Transcript of The Discrete Ray-casting Algorithm Qiang Xue Jiaoying Shi State Key Lab Of CAD&CG Zhejiang...

The Discrete Ray-casting Algorithm

Qiang Xue Jiaoying Shi

State Key Lab Of CAD&CG

Zhejiang University

OUTLINES

• Introduction• Fundamentals to Accelerate

Volume Rendering• Implementation of Discrete Ray-

casting Algorithm• Results• Conclusion

Introduction• Volume rendering is a computation

intensive procedure

• Solutions for real-time volume rendering: hardware-based and software-based

• Software-based method uses spatial coherence [1] and inter-view coherence [2]

• Our method:discrete ray-casting algorithm

Fundamentals to Accelerate Volume Rendering

• Coherence in volume rendering

– Coherence in object space

– Coherence in image space

– Coherence between consecutive image frames

• Shear-warp factorization

Fundamentals to Accelerate Volume Rendering

• Shear-warp factorizationProperty 1: Scanlines of pixels in the intermediate image are parallel to scanlines of voxels in the volume data; Property 2: All voxels in a given voxel slice are scaled by the same factor;

Property 3: For parallel projection, every voxel slice has the same scale factor, and this factor can be chosen arbitrarily.

Fundamentals to Accelerate Volume Rendering

• Exploiting the inter-view coherence– visible information of two adjacent

viewpoints is nearly coherent– In ray-casting method, between

consecutive image frames rays forming a pixel share a lot of ray segment

– Our idea is to store these shared ray segments when creating one frame and use them to construct new frames

Fundamentals to Accelerate Volume Rendering

• Exploiting the inter-view coherence– Our algorithm pipeline:

1 、 (Preprocessing) In viewpoint k=k1,

compute ray segments set S=S1.

2 、 Composite rendered image from S.

3 、 If S is available to compute next frame

then turn to stage 2 else to stage 1.

Fundamentals to Accelerate Volume Rendering

Implementation of Discrete Ray-casting Algorithm

• Discrete Rotation– A rotation can be performed by "shearing"

the parallelepiped with discrete units in two axis directions.

– Users’ interactions can be viewed as incremental

z

x

y

a

• Split a Ray into Ray Segments– Ray segments shared between two consec

utive frames.

– If we store these different levels of ray segment rendering results, we would be able to construct new frames from them promptly.

x

zRay segmentVoxels

View rays

Implementation of Discrete Ray-casting Algorithm

• Rendering Operation– A source-attenuation illumination model

is used in the algorithm.

– where S is voxel intensity, and M is attenuation coefficient.

dtetSI tdppM

])([))((

Implementation of Discrete Ray-casting Algorithm

• Construct Ray Segment Table– Let Ri(x,y,a) denote the rendering result o

f ray segments sized of 2i pixels, where x and y are segments’ starting coordinates, and a is the number of shearing units along x-axis.

Implementation of Discrete Ray-casting Algorithm

Implementation of Discrete Ray-casting Algorithm

• Construct Ray Segment Table

– Constructing 2D ray segment tableRi(x,y,a)=Ri-1(x, y, a/2)Ri-1(x+a/2, y+2i-1, a/2)

– 3D ray segment tables can be constructed in the similar way.

• Construct Ray Segment Table

Implementation of Discrete Ray-casting Algorithm

• Complexity Analysis

– There are n kinds of discrete rotation degree within [0, /4] when rotating about one axis. So a number of n2 kinds of rotation results can be got when rotating about two axes.

Implementation of Discrete Ray-casting Algorithm

• Complexity Analysis

– Each rendering result needs constructing O(n2) ray segments, a totally O(n4) computation must be performed to prepare every result for n2 kinds of view positions.

Implementation of Discrete Ray-casting Algorithm

• Complexity Analysis

– On average, a frame can be computed with a complexity of only O(n2), while traditional algorithm requires O(n3).

Implementation of Discrete Ray-casting Algorithm

• Complexity Analysis– The average rendering time t for one frame

can be approximated as:

where t1 denotes time needed to construct a

frame from ray segments, t2 is preprocessing time required to refresh the whole ray segments table, and f2 is its refreshing rate.

221 tftt

Implementation of Discrete Ray-casting Algorithm

• Complexity Analysis– Instead of computing all of the final resul

ts in the preprocessing session, we prepare only those ray segments no longer than 2k voxels.

– From these segments, n/2k×n/2k kinds of frames can be constructed, each needs O(n3/2k) computing time.

Implementation of Discrete Ray-casting Algorithm

• Run-Length Encoding– According Property 1 of the shear-warp spac

e, the volume and image data structures can both be traversed in scanline order.

– A run-length encoding of the ray segment scanlines is used.

– The encoded scanlines consist of two types of runs, transparent and non-transparent, defined by a user-specified opacity threshold.

Implementation of Discrete Ray-casting Algorithm

• Run-Length Encoding

– To take advantage of coherence in the image, we store with each opaque intermediate image pixel an offset to the next non-opaque pixel in the same scanline.

Implementation of Discrete Ray-casting Algorithm

Implementation of Discrete Ray-casting Algorithm

• Run-Length Encoding– The offsets associated with the image

pixels are used to skip runs of opaque pixels without examining every pixel.

– The pixel array and the offsets form a run-length encoding of the intermediate image which is computed on-the-fly during rendering.

• Run-Length Encoding– By marching through the ray segment ta

ble and the image simultaneously in scanline order we reduce addressing arithmetic.

– By using the run-length encoding, we perform work only for segments which are both non-transparent and visible.

Implementation of Discrete Ray-casting Algorithm

• Run-Length Encoding– Scanline composition

skip work skip work skip

transparent ray segment run

non-transparent ray segment runopaque image pixel run

non-opaque image pixel run

ray segment scanline

image scanline

compositing

Implementation of Discrete Ray-casting Algorithm

Results

• Performance of Discrete Ray-casting algorithm

size of dataset t1(s) t2(s) f(f/s)646464 0.3 0.1 8.312812884 1.2 0.4 1.8256256109 4.2 0.9 0.7t1: time used to construct ray segment table;

t2: time used to render a frame from ray segment

table;

f : average frame rate.

Results• Performance comparison between Dis

crete Ray-casting algorithm and traditional one.

size of dataset f1(f/s) f2(f/s)

646464 8.3 0.6

12812884 1.8 0.2

256256109 0.7 <0.1f1: average frame rate of discrete ray-casting algorithm;

f2: average frame rate of traditional ray-casting

algorithm.

Conclusion And Future Work

• Conclusion

– New viewpoint images can be quickly approximated by using rendered ray segments.

Conclusion And Future Work

• Conclusion

– We combined this fast approximation with shear-warp factorization to fully exploit the coherences in volume dataset rendering process.

Conclusion And Future Work

• Conclusion

– Rendering speed for a 1283 volume is roughly 0.1 second on a PC platform without specialized hardware.

Conclusion And Future Work

• Future work– To extend our rendering algorithm to supp

ort interactive navigation through the 3D dataset.

– The discrete ray-casting algorithm parallelizes naturally for MIMD shared-memory multiprocessors.