370 likes | 615 Views
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.
E N D
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
Fundamentals to Accelerate Volume Rendering • Shear-warp factorization
Fundamentals to Accelerate Volume Rendering • Shear-warp factorization Property 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.
z a x y 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
Ray segment Voxels View rays z x Implementation of Discrete Ray-casting Algorithm • Split a Ray into Ray Segments • Ray segments shared between two consecutive frames. • If we store these different levels of ray segment rendering results, we would be able to construct new frames from them promptly.
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.
Implementation of Discrete Ray-casting Algorithm • Construct Ray Segment Table • Let Ri(x,y,a) denote the rendering result of 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 • Construct Ray Segment Table • Constructing 2D ray segment table Ri(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.
Implementation of Discrete Ray-casting Algorithm • 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.
Implementation of Discrete Ray-casting Algorithm • Complexity Analysis • Instead of computing all of the final results 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 space, 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 • 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.
Implementation of Discrete Ray-casting Algorithm • Run-Length Encoding • By marching through the ray segment table 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.
ray segment scanline compositing image scanline skip work skip work skip transparent ray segment run non-transparent ray segment run opaque image pixel run non-opaque image pixel run Implementation of Discrete Ray-casting Algorithm • Run-Length Encoding • Scanline composition
Results • Performance of Discrete Ray-casting algorithm
Results • Performance comparison between Discrete Ray-casting algorithm and traditional one.
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 support interactive navigation through the 3D dataset. • The discrete ray-casting algorithm parallelizes naturally for MIMD shared-memory multiprocessors.