A Survey of GPU-Based Volume Rendering of Unstructured Grids

3 downloads 0 Views 3MB Size Report
A Survey of GPU-Based Volume Rendering of Unstructured. Grids. Cláudio T. Silva 1. João L. D. Comba 2. Steven P. Callahan 1. Fabio F. Bernardon 2. Abstract:.
A Survey of GPU-Based Volume Rendering of Unstructured Grids Cláudio T. Silva 1 João L. D. Comba 2 Steven P. Callahan 1 Fabio F. Bernardon 2

Abstract: Real-time rendering of large unstructured meshes is a major research goal in the scientific visualization community. While, for regular grids, texture-based techniques are well-suited for current Graphics Processing Units (GPUs), the steps necessary for rendering unstructured meshes are not so easily mapped to current hardware. This paper reviews volume rendering algorithm and techniques for unstructured grids aimed at exploiting high-performance GPUs. We discuss both the algorithms and their implementation details, including major shortcomings of existing approaches.

Resumo: A visualização volumétrica de grandes malhas não estruturadas é uma das principais metas da comunidade de visualização científica. Enquanto que em grades regulares o uso de técnicas baseadas em textura são adequadas para as Unidades de Processamento Gráfico (GPUs) atuais, os passos necessários para exibir malhas não estruturas não são diretamente mapeadas para o hardware atual. Este artigo revisa algoritmos e técnicas de visualização volumétrica que exploram GPUs de alta performance. São discutidos tanto os algoritmos como seus detalhes de implementação, incluindo as principais dificuldades das abordagens atuais.

1

Introduction

This paper contains a survey of volume visualization techniques for unstructured volumetric meshes. This manuscript was not designed as a comprehensive survey. Instead, we cover the material that will be presented at our tutorial to be given at the XVII Brazilian Symposium on Computer Graphics and Image Processing (SIBGRAPI 2005). Our emphasis on unstructured data is unique when compared to other recent surveys, e.g., [7, 31], which are 1 Scientific

Computing and Imaging Institute, University of Utah, 50 S Central Campus Dr, Room 3490, Salt Lake City, UT 84112, USA {[email protected], [email protected]} 2 Universidade Federal do Rio Grande do Sul, Instituto de Informática, Av. Bento Goncalves, 9500, Campus do Vale, Bloco IV, Prédio 4325, Porto Alegre, RS 91501-970, Brasil {[email protected], [email protected]}

A Survey of GPU-Based Volume Rendering of Unstructured Grids

often comprehensive in coverage and have a stronger focus on regular datasets. Our coverage is necessarily biased to the work that we know best, and to that work that we have performed ourselves. Whenever possible, we try to give extra insights on some topics not directly described in the original references, or to point to more general frameworks that can enlighten the material. We hope our discussion of current techniques is useful to other people interested in this area. (We wrote this paper when the current GPUs were represented by the ATI X800 and the NVIDIA 6800 series.)

2

Volume Rendering Techniques

For the visualization of three-dimensional scalar fields, direct volume rendering has emerged as a leading, and often preferred, method. In rendering volumetric data directly, we treat space as composed of semi-transparent material that can emit, transmit, and absorb light, thereby allowing one to “see through” (or see inside) the data [49]. Volume rendering also allows one to render surfaces, and, in fact, by changing the properties of the light emission and absorption, different lighting effects can be achieved. Volumetric representation leads to different visualization techniques. For instance, regular grids have a well-defined structure that can be explored when designing visualization algorithms. Today, texture-based visualization [29] is central to many different algorithms for regular grids. On the other hand, unstructured grids composed of meshes of tetrahedra are more challenging, and have led to a larger variety of different techniques, e.g., [10, 48, 55, 61, 64, 66, 70]. In this section we review some of the techniques that have been efficiently mapped to GPUs. 2.1 Texture-Based Techniques In many volumetric applications, data is obtained from a regular sampling approach that leads to a discrete representation of regular grids. In 3D, regular grids are usually stored as a volumetric table containing data from the sampled function (e.g., scalar values, color, etc.) in each cell (usually referred to as a voxel). Generating volume rendering images of regular grids requires sampling the information stored in this table in visibility order (either front-to-back or back-to-front). This requires either computing successive intersections of the volume against a given ray (a ray casting approach) or along parallel planes. Texture-based visualization is a technique that exploits the texture-based functionality of the graphics hardware to solve the above problem efficiently. Regular grid data is stored directly in the GPU memory as textures. Early graphics boards only supported 2D textures in hardware, which made volumetric visualization only possible by representing volumetric data as stacks of 2D images. Preliminary approaches sample the volume with parallel

2

RITA • Volume X • Número 1 • 2005

A Survey of GPU-Based Volume Rendering of Unstructured Grids

Figure 1. Texture-based visualization uses parallel planes orthogonal to the viewing direction to sample the volume.

planes (proxy geometry) that change according to the the viewing parameters. To avoid artifacts, data is replicated in the three directions, increasing memory usage. Avoiding this extra storage requires on-the-fly slice reconstruction at the expense of performance overhead [38]. Another problem that arises here is the dependency on the sampling rate used to produce the regular grid, which can be avoided by using extra slices and trilinear filtering [56]. The advent of 3D texturing capabilities even further improved the ways that the graphics hardware can be used to perform volumetric visualization. Since the volume data is naturally stored as a 3D texture, it suffices to use a proxy geometry consisting of a set of parallel polygons orthogonal to the viewing direction (Figure 1). The scalar values stored in 3D textures are processed in pairs of successive slices. For each pair of scalar values, lighting calculation accumulate the color contribution of one ray segment using the volume rendering integral. The use of approximations of the volume rendering integral calculations are often useful to speed up this process. The pre-integration approach described in [22] computes an approximation that takes into account the scalar values sampled at two different positions of the ray and the distance between each sample to produce color and opacity values based on a given transfer function. The resulting calculations are stored as a 3D texture accessed by the scalar values (x-axis and y-axis) and distance (z-axis) during rasterization, then combined into the accumulated final color. The discretization used in the pre-integration might introduce some artifacts because it assumes a linear progression of the scalar values between slices. An adaptive approach is proposed in [57] that tries to overcome this problem with an adaptive sampling rate based on the actual information stored in the volume and the transfer function used. In [37], several techniques are discussed to reduce the cost of per-fragment operations perfomed during texture-based visualization. Empty-space skipping techniques allow

RITA • Volume X • Número 1 • 2005

3

A Survey of GPU-Based Volume Rendering of Unstructured Grids

VISUALIZATION AND COMPUTER GRAPHICS, VOL. 10,

NO. 6,

NOVEMBER/DECEMBER 2004

tegral for a pixel requires the sorted order.

Fig. 2. A back-to-front ordering of the cells of a mesh. Note that a visibility ordering can be somewhat unintuitive. For instance, note that cell 3 comes before cell 4 in a correct visibility ordering, although the centroid of cell 4 is farther from the viewer than the centroid of cell 3. that keepFigure the 2. original A back-to-front ordering of the cells of a mesh. Note that a visibility ordering can This same error could occur if the sort was based on the power distance. be somewhat unintuitive. Forreason instance, that cell 3 comes celldistance 4 in a correct This is the that note simple schemes, such before as power sorts or organized as follows: In although visibility ordering, the centroid of cell 4 fail is farther from the viewpoints viewer thanortheviewing centroid xel requires the centroid-based sorts, may from certain Fig. 2. A back-to-front ordering of the cells of a mesh. Note that a finitions ofand then, in can cellvisibility 3. This same error occur if the sort based onthat the power distance. This is the directions. ordering be could somewhat unintuitive. For was instance, note

celldescribe 3 comes before cell 4 in such a correct visibilitydistance ordering, sorts although the In Section 4, we reason that simple schemes, as power or centroid-based sorts, may fail centroid of cell 4 is farther from the viewer than the centroid of cell 3. the original edra visibilityThisordering from certain viewpoints or viewing directions. faces. (Two or more meshes that are disconnected are often same error could occur if the sort was based on the power distance. 5, we present This a detailed is the reason that simple schemes, as power distance or referred to as a such single mesh withsorts disconnected components.) A as follows: In centroid-based may fail from certain viewpoints or viewing he SXMPVO algorithm, sorts, segment of a ray between a point on an exterior face of a nd then, in directions. processing to quickly skip entire regions of the volume do not relevant Finally, in Section 6, we mesh where the ray leaves thethat mesh andcontain another suchinformapoint 4, we describe tion, which is often the case in sparse datasets. In addition, an early-ray termination allows conclusions. where the ray reenters a mesh we call a ray-gap. We refer to lity ordering faces. (Two or more meshes that are disconnected are often computation to stop when sufficient opacity values have been accumulated. nt a detailed referred to as a single a mesh that has cells of different types, e.g., tetrahedra, mesh with disconnected components.) A O algorithm, segment of a ray between a point on an face ofasa a zoo mesh. hexahedra, prisms, andexterior pyramids, Section 6, we mesh where the ray leaves the mesh and another such point For sorting nonconvex meshes, we need to consider 2.2 where Visibility Ordering . the ray reenters a mesh we call a ray-gap. We refer to t with a few definitions, visibility relations among exterior faces and this involves a mesh that has cells of different types, e.g., tetrahedra, The viewpoint vp someprisms, theirand orientation, as follows: useviewpoint, the termisfront Aisvisibility ordering ofpyramids, a set of objects (seemesh. Figure 2), fromWe a given a total hexahedra, asdefined a zoo presenting the on viewer or such order the sorting objects that object a obstructs object b, cell then bfaces precedes a in the ordering. faces or iffront-facing refer whose outward For nonconvex meshes, wetoneed to to consider w Suchas orderings are useful for rendering volumetric data,involves because enables efficient ondefinitions, is defined follows: normals have a positive in itthe direction of use theof visibility relations among exterior faces andcomponent this nt some theirhardware orientation, defined as follows: We use the projections, term front graphics 70]. viewpoint, for perspective or a negative dot of vp a is mesh S and intðc 1 Þ [61, faces or front-facing to refer to the cell view faces direction, whose outward product with for orthogonal projection. cthe viewer and cor 2 . Relative to In computer work on visibility ordering of wasthepioneered by Schumacker et ed1 as follows: normals have agraphics, positive component in the direction Similarly, back-facing faces are those whose normals point eSisand a half-line hl starting viewpoint, for perspective or a negative dot intðcal. is later reviewed in [65].projections, An early solution to computing a visibility order given 1 Þ and away from the viewpoint or agree with the view direction. and p in hl \ intðc Þ so product with the direction, orthogonal 2 2Newell, Relative to Newell, by andview Sancha (NNS)for [51] continuesprojection. to be the basis for more recent techSimilarly, back-facing faces are those whose normals point A visibility ordering can ne hl starting niques [64]. The NNS algorithm starts by partially ordering the primitives according to their away from the viewpoint or agree with the view direction. hlor\ a intðc Þ so 2 depth. given viewpoint, Then, forif each the algorithm 3 primitive, RELATED WORK improves the ordering by checking whether ordering canafter b in the must come other primitives precede it or not. Fuchs, Kedem, and Naylor [26] developed the Binary viewpoint, if 3 RELATED W InORK this section, we start with a discussion of several different viewpointSpace remains fixed tree Partitioning (BSP-tree) — a data structure that represents a hierarchical convex after b in the techniques for implementing the rendering phase of cell is selected, the visibility In this section, we start with(typically, a discussion of Since severalvisibility differentorder is essential for volume decomposition of a given space R3 ). remains fixed projection volume rendering, including thebeen onedeveloped used for techniques renderingmany phase of cell have unstructured grids via cellthe projection, techniques that stillvisibility validrendering and does notfor implementing the this paper. Next, in Section 3.2, we cover the MPVO projection volume rendering, including the one used for order the tetrahedra [16, 18, 34, 62, 70]. and does not nd compositing the cells this paper. Next, in Section 3.2, we cover the MPVO iting theorder) cells results in a algorithm since our algorithm and some other algorithms o-front algorithm since our algorithm andare some otheron algorithms An intuitive overview of thelater Meshed Polyhedra Visibility Ordering (MPVO)3.3, algorithm discussed based it. Then, in Section we r) results in a mage. discussed later are based it. Then, in Sectiongraph 3.3, for we [70] is as follows (see Figure 3).onFirst, the methods, adjacency cells are of a integrated given convex cover other sorting some of the which methods, some of which are integrated thatcover c1