Efficient Ray Casting of Volumetric Images Using Distance Maps For
Total Page:16
File Type:pdf, Size:1020Kb
Computational Visual Media https://doi.org/10.1007/s41095-019-0155-y Vol. 6, No. 1, March 2020, 53–63 Research Article Efficient ray casting of volumetric images using distance maps for empty space skipping Lachlan J. Deakin1 ( ), Mark A. Knackstedt1 c The Author(s) 2019. Abstract Volume and isosurface rendering are methods 1 Introduction of projecting volumetric images to two dimensions for Volumetric images (volumes) are three-dimensional visualisation. These methods are common in medical scalar fields of voxels (volume + pixels). Volumes imaging and scientific visualisation. Head-mounted optical see-through displays have can be acquired with imaging technologies such recently become an affordable technology and are a as Computed Tomography (CT) and Magnetic promising platform for volumetric image visualisation. Resonance Imaging (MRI) which make it possible Images displayed on a head-mounted display must be to see inside opaque physical objects or people. presented at a high frame rate and with low latency Computer graphics hardware and pipelines have to compensate for head motion. High latency can be generally been optimised for rendering surface jarring and may cause cybersickness which has similar representations of scenes. Volumes are not surfaces and symptoms to motion sickness. must be rendered with specialised volume rendering Volumetric images can be very computationally techniques. Volume ray casting is a common volume expensive to render as they often have hundreds of rendering method well suited to acceleration on a millions of scalar values. Fortunately, certain materials Graphical Processing Unit (GPU) [1–3]. Rays are in images such as air surrounding an object boundary projected from each pixel of a display which pass are often made transparent and need not be sampled, through volumes and composite the colours and which improves rendering efficiency. opacities of the voxels they pass through. In our previous work we introduced a novel Voxels can be assigned a colour and opacity ray traversal technique for rendering large sparse based on their scalar value (and often their gradient volumetric images at high frame rates. The method magnitude) according to a transfer function. Transfer relied on the computation of an occupancy and distance functions can be manipulated by a user to control map to speed up ray traversal through empty regions. the appearance and visibility of different materials. In this work we achieve higher frame rates than our Lighting effects such as shadowing, specularity, and previous work with an improved method of resuming empty space skipping and the use of anisotropic scattering can be applied but are not widely used in Chebyshev distance maps. An optimised algorithm for medical image analysis. computing Chebyshev distance maps on a graphical Isosurfaces are surfaces representing constant scalar processing unit is introduced supporting real-time values within a volume [4]. An isosurface can be transfer function editing. extracted as a mesh and rendered using conventional surface rendering techniques. Isosurfaces can also Keywords ray casting; volume rendering; isosurface be rendered using ray casting directly on an image rendering; distance maps without a mesh extraction [5]. Modern augmented reality Head-Mounted Displays (HMDs) which are optically see-through enable new 1 Australian National University, Canberra, 2601, Australia. E-mail: L. J. Deakin, [email protected] ( ); volumetric image visualisation applications. These M. A. Knackstedt, [email protected]. devices are able to resolve their position as a user Manuscript received: 2019-12-14; accepted: 2019-12-21 moves his/her head and eyes. This makes it possible 53 54 L. J. Deakin, M. A. Knackstedt for a virtual object to be displayed in a user’s field of • an algorithm for efficiently generating isotropic view which may appear fixed in space or potentially and anisotropic Chebyshev distance maps on a aligned to a physical object. For example, a surgeon GPU for accelerated ray casting, and could visualise a CT or MRI image overlaid on • an extended performance analysis of the approach a patient without referring to an external display. with 2D transfer functions and various occupancy This application would provide depth perception of map region sizes. internal structures within the body and a surgeon would not need to look away from their hands. 2 Related work Images must be displayed on a HMD at high frame rates and with low latency to sufficiently compensate Empty space can be skipped when ray casting for head and eye motion. Otherwise, the wearer by only sampling between geometry which tightly of a HMD may experience cybersickness. Virtual bounds the occupied space within a volume [5]. The reality HMDs fully replace a user’s view of the world bounding geometry may be defined by coarse bricks and current generation devices require frames to be or a meshed isosurface. These approaches typically rendered at 90 Hz. Recent augmented reality HMDs only skip external empty space and may have a high overhead from rasterisation of the bounding with see-through displays require lower frame rates geometry. Generating the bounding geometry can of around 60 Hz. also be computationally expensive. Volume rendering can be very computationally Kruger and Westermann [1] created an occupancy expensive, particularly for high resolution images. map indicating which 83 regions of a volume are Rays passing through a volume may require a large empty. A ray caster can use the occupancy map to number of samples of the volumetric image texture skip sampling points in empty regions and reduce the before an output colour is determined or an isosurface total number of texture samples. Their occupancy is located. Ray casting must be accelerated to higher map has a low memory overhead as it has a low frame rates for visualisation on HMDs. resolution compared to the volume. Most volumetric images have some portion of Distance maps encoding the Chebyshev distance empty space which does not contribute to the output metric to the nearest occupied voxel have proven image. For volume rendering, empty space refers to be effective for ray casting acceleration [7, 8]. A to voxels which have zero opacity as defined by the ray is able to skip many voxels with a single sample transfer function. For example, the air surrounding of the distance map if far away from an occupied an object and some object materials may be made voxel. These approaches can substantially improve entirely transparent. Voxels which are not adjacent to frame rates for sparse images but the time needed surface interfaces are considered empty for isosurface to generate distance maps can inhibit interactive rendering. Empty space can be skipped to reduce the transfer function editing. number of texture samples and improve frame rates. Massive volumetric images which may not fit entirely We recently introduced an efficient empty space within GPU memory are becoming increasingly skipping approach for ray casting [6]. A reduced common from simulations and high-resolution imaging resolution occupancy map is generated describing technology. They can be rendered by only allocating which regions of a volume are occupied. A distance occupied bricks (regions) on the GPU [3, 9, 10]. Bricks map is then generated which encodes the Chebyshev can be referenced in hierarchical structures (such as distance to the nearest occupied region. The distance an octree) and empty bricks are simply skipped as the map is used to efficiently leap rays past empty regions structure is traversed. during voxel traversal and reduce the number of SparseLeap [10] rasterises occupied hierarchically unnecessary texture samples. referenced bricks into per-pixel linked lists. Only the This paper is an extended version of our previous occupied segments of rays go through the ray casting short format paper [6] which provides more details pipeline. Their method outperformed octree-based of the method and introduces: empty space skipping and could be used to render • an optimisation of the ray traversal approach terabyte sized sparse volumes. Bricks are not loaded to more effectively skip empty space within and onto the GPU if they are outside of the field of view behind objects, or occluded. Efficient ray casting of volumetric images using distance maps for empty space skipping 55 Our previous paper described an efficient method gradient magnitude of a voxel can be computed of empty space skipping utilising distance maps [6]. efficiently using the tetrahedron method [11] shown in Interactive transfer function editing was supported Algorithm 1 which is written in the OpenGL Shading by updating reduced resolution distance maps on the Language (GLSL). This method requires only 4 voxel GPU and massive volumes could be rendered by only neighbour samples unlike the conventional central allocating occupied bricks. Our method outperformed differences approach which requires 6. SparseLeap, octree-based, and bounding geometry (isosurface) acceleration on a set of images. Algorithm 1 Tetrahedron technique for voxel gradient magnitude calculation (GLSL) 3 Our approach layout (...) uniform sampler3D image; // global float gradient_tetrahedron_method(ivec3 pos) { ivec2 k=ivec2(1,-1); 3.1 Ray traversal vec3 gradient_dir = 0.25f * vec4( k.xyy * imageLoad(image, pos + k.xyy).x + A volumetric image is stored on a GPU as a 3D k.yyx * imageLoad(image, pos + k.yyx).x + d k.yxy * imageLoad(image, pos + k.yxy).x + texture with dimensions =[width, height, depth]. k.xxx * imageLoad(image,