Fast Global Illumination for Visualizing Isosurfaces with a 3D Illumination Grid
Total Page:16
File Type:pdf, Size:1020Kb
A NATOMIC R ENDERING AND V ISUALIZATION Fast Global Illumination for Visualizing Isosurfaces with a 3D Illumination Grid Users who examine isosurfaces of their 3D data sets generally view them with local illumination because global illumination is too computationally intensive. By storing the precomputed illumination in a texture map, visualization systems can let users sweep through globally illuminated isosurfaces of their data at interactive speeds. isualizing a 3D scalar function is an ing) the equation for light transport. Generally, important aspect of data analysis in renderers that solve the light transport equation science, medicine, and engineering. are implemented in software and are conse- However, many software systems for quently much slower than their hardware-based 3DV data visualization offer only the default ren- counterparts. So a user faces the choice between dering capability provided by the computer’s fast-but-incorrect and slow-but-accurate displays graphics card, which implements a graphics li- of illuminated 3D scenes. Global illumination brary such as OpenGL1 at the hardware level to might make complicated 3D scenes more com- render polygons using local illumination. Local prehensible to the human visual system, but un- illumination computes the amount of light that less we can produce it at interactive rates (faster would be received at a point on a surface from a than one frame per second), scientific users will luminaire, neglecting the shadows cast by any continue to analyze isosurfaces of their 3D scalar intervening surfaces and indirect illumination data rendered with less realistic, but faster, local from light reflected from other surfaces. This illumination. simplified version of light transport is nonphys- We propose a solution to this trade-off that in- ical, but it produces images that look 3D and volves precomputing global illumination and that graphics hardware can generate at rates of storing the values in a 3D illumination grid. We millions of triangles per second. can perform this task as a batch process on mul- By comparison, more realistic global illumina- tiple processors. Later, when the user applies a tion results from solving (or at least approximat- visualization tool to sweep through level sets of the scalar function, the precomputed illumina- tion is simply texture mapped at interactive rates 1521-9615/07/$20.00 © 2007 IEEE onto the isosurfaces. Consequently, users can Copublished by the IEEE CS and the AIP perform arbitrarily complex illumination calcu- DAVID C. BANKS lations (for example, to capture subsurface scat- University of Tennessee / Oak Ridge National Laboratory tering or caustics) and display the results in real Joint Institute for Computational Science time while examining different level sets. This strategy lets users apply realistic illumination at KEVIN BEASON interactive speeds in a data visualization software Rhythm and Hues Studios system. 48 THIS ARTICLE HAS BEEN PEER-REVIEWED. COMPUTING IN SCIENCE & ENGINEERING (a) (b) Figure 1. A mouse neuron, imaged with confocal laser microscopy, has numerous long thin dendrites projecting outward from the cell body. (a) With local illumination, it’s difficult to discern the dendrites’ relative depths. (b) With global illumination, shadows near a crossing (such as the X shape on the lower left) indicate that the two dendrites are nearly touching. (a) (b) Figure 2. Two hemispheres of a human brain separated by the cleft of the central commissure. (a) With local illumination, even the cleft’s deepest section (the bright crescent at the bottom center) is as bright as the cortex’s outermost surface. (b) With global illumination, the cleft is immediately evident as a dark valley. Global Illumination biguates the dendrites’ relative depths at crossing Determining the spatial arrangement of one fea- points in the image. ture with respect to another is a basic concern for Global illumination is also useful for displaying a user analyzing 3D data. However, if a scene is depth in isosurfaces with complicated shapes. Fig- complex, with many objects obstructing others, it ure 2 shows an isosurface of the brain from magnetic can be tedious or even impossible for a user to se- resonance imaging (MRI) data. Global illumination lect a viewpoint that clearly discloses the different in Figure 2b makes the central commissure (sepa- objects’ relative pose. As data sets grow in size, their rating the cerebral hemispheres) readily apparent. geometric complexity generally grows as well. Fig- We presented both images in Figure 2 to one of our ure 1 illustrates a complicated isosurface rendered collaborators (a neurosurgeon), who remarked that with local and global illumination. This data set, the globally illuminated image in Figure 2b “is what imaged ex vivo using confocal microscopy, shows a a brain actually looks like.” Although making 3D neuron from a mouse hippocampus with several surfaces look real might not be data visualization’s long cylindrical dendrites emanating from the cell most important task, users deserve to have this body. Global illumination in Figure 1b disam- choice available when they’re analyzing data. JANUARY/FEBRUARY 2007 49 9 10 13 18 25 2 3 6 11 18 2 3 2 3 4 5 8 13 20 −3 −2 1 6 13 −3 −2 1 −3 −2 1 1 2 5 10 17 −6 −5 −2 3 10 −2 3 −2 3 0 1 4 9 16 −7 −6 −3 2 9 −3 2 −3 2 (a) (b) (c)(d) (e) 2 2 Figure 3. Level set Lc of the function h(x, y) = x + y . The isovalue c = 7 yields a circle of radius 7 centered at the origin. (a) h evaluated at grid points. (b) h – 7 evaluated at grid points. (c) Squares and edges that straddle negative and positive values of h – 7. (d) Roots (yellow) of h – 7. (e) The level set L7 approximated by a polyline (gold). Isosurfaces gine generates a polygonal mesh representing Lc. Examining scalar-valued data on a 3D grid is a Finally, the graphics card displays the mesh (us- common starting point for 3D visualization. Such ing local illumination). For scalar data sets of size data sets arise, for example, from a patient’s MRI, 256 ´ 256 ´ 256, an ordinary desktop computer in confocal microscopy of cells and tissue, in the can perform this pipeline of tasks at interactive solution of heat flow on a 3D domain, or from rates. Running a global illumination code to computing vorticity magnitude in a turbulent make the isosurface look more realistic, however, flow. The scalar function h(x): ޒn ® ޒ assigns a can add tens of minutes to the display time when ޒn real value to each point x in . A level set Lc of h the isovalue c is updated. is the locus of points x satisfying Lc = {x: h(x) – c = To achieve an interactive display rate while ren- 0}, which corresponds to points x lying on the in- dering globally illuminated isosurfaces, the visual- tersection of the graph of h and the hyperplane at ization system can absorb the calculation of light height c. Sweeping through level sets is a standard transport into a precomputing stage. In the most way for a user to examine such a scalar function. naive approach, the system would repeatedly ex- In the 3D case (n = 3), the level set forms an iso- tract isosurface after isosurface of the function h, surface in ޒ3. compute global illumination for each isosurface, A typical 3D data set contains the values of h only and then store the illuminated meshes—all before at discrete points xa on the grid, so we must infer the user even begins an interactive session to sweep the values of h at nongrid points from the grid val- through the data. As the user moves a slider bar in ues by some interpolation scheme. Researchers the GUI, the visualization system would simply re- have widely used the marching cubes (MC) algo- trieve the mesh with precomputed illumination. rithm2 for interpolating the data and constructing The storage cost, however, for archiving an unlim- a polygonal mesh approximating the isosurface. ited number of isosurfaces is unreasonably high. A MC uses linear interpolation to locate roots of h(x) more prudent tactic is to store only the illumina- – c at points along edges of cubes tiling the domain tion values and then “paint” them onto isosurfaces, and then connects the points into polygons. Figure a generic technique known as texture mapping, 3 illustrates a version of the MC algorithm in two which we describe later. dimensions, called marching squares, for a scalar function defined on a grid in the plane whose level Illumination as a Texture Map sets are curves. Figure 3a shows the values at grid Texture mapping (see Figure 4) assigns a coordi- points in the plane’s positive quadrant of the func- nate chart to a surface and then applies colors from 2 2 tion h(x, y) = x + y , which has level sets Lc = {(x, y): a 2D image onto the surface according to the tex- x2 + y2 = c} that are circles of radius c . The grid ture coordinates. With 3D texture mapping, we as- points define squares that tile the domain. Figure sign each vertex of the mesh a triple (i, j, k) of 3b shows the evaluation of h – c when the isovalue texture coordinates that index into a 3D volume of c happens to be seven. colors. We can exploit 3D textures to paint realis- A typical software system for generating iso- tic lighting onto polygons much faster than the surfaces—the isosurface engine—connects the iso- lighting can actually be computed (in milliseconds value c with a GUI component that the user sees. rather than minutes). The user moves a slider bar to dynamically During the precomputation phase, a series of change the isovalue, and then the isosurface en- isosurfaces is constructed and globally illuminated 50 COMPUTING IN SCIENCE & ENGINEERING using a numerical solver for light transport.