Efficient Volume Rendering on the Face Centered and Body Centered Cubic Grids
Total Page:16
File Type:pdf, Size:1020Kb
UPTEC IT 12 013 Examensarbete 30 hp Augusti 2012 Efficient Volume Rendering on the Face Centered and Body Centered Cubic Grids Max Morén Abstract Efficient Volume Rendering on the Face Centered and Body Centered Cubic Grids Max Morén Teknisk- naturvetenskaplig fakultet UTH-enheten In volumetric visualization, the body centered cubic grid (BCC) and its reciprocal, the face centered cubic grid (FCC), are despite their good sampling properties not well Besöksadress: off regarding available rendering software and tools. Ångströmlaboratoriet Lägerhyddsvägen 1 Hus 4, Plan 0 Described in this thesis is the development of an extension for the volume rendering engine Voreen, implementing two recently presented GPU accelerated reconstruction Postadress: algorithms for these grids, along with a simple nearest neighbor method. These Box 536 751 21 Uppsala reconstruction methods replaces the trilinear reconstruction method used for data stored in a Cartesian cubic grid (CC). The goal is for the produced software to be Telefon: useful for efficiently visualizing results from experiments with the BCC and FCC grids 018 – 471 30 03 and thus help make such data easier to observe. Telefax: 018 – 471 30 00 The performance and rendering quality of the new raycasters is measured and compared to Voreen's existing Cartesian cubic ray caster. The experimental results Hemsida: show that the raycasters can render data in the BCC and FCC format at interactive http://www.teknat.uu.se/student frame rates while maintaining comparable visual quality. Handledare: Elisabeth Linnér Ämnesgranskare: Robin Strand Examinator: Arnold Pears ISSN: 1401-5749, UPTEC IT 12 013 Sammanfattning Inom volumetrisk visualisering är den mest använda sampelstrukturen utan tve- kan det kartesiska gittret. Denna struktur är kanske det enklaste sättet att lag- ra tredimensionella skalärfält och har använts länge. Det har dock visat sig att samplingsegenskaperna för denna typ av gitter är långt ifrån optimala i alla lä- gen. Det kubiska rymdcentrerade gittret (BCC) och dess dual, det kubiska yt- centrerade gittret (FCC), är betydligt bättre när det gäller samplingseffektivitet för bandbegränsade signaler. Trots detta är verktyg för att rendera data lagrad i dessa gitter svåra att hitta. I detta examensarbete utvecklas en tilläggsmodul för volymrenderingsprogram- met Voreen. Voreen är ett ramverk för att rendera volymetrisk data framförallt genom raycasting. Voreen byggs i detta arbete ut med nya komponenter för att utföra raycasting på data i BCC- och FCC-format användandes två nyligen pre- senterade rekonstruktionsmetoder. Dessa metoder ersätter den trilinjära rekon- struktionsmetoden som används för data lagrad i kartesisk struktur, och kan även de producera bilder i realtid. De nya komponenternas prestanda och bildkvalitet mäts och jämförs med den existerande kartesiska raycastern i Voreen. Resultaten visar att trots en viss skill- nad i prestanda kan den nya mjukvaran producera bilder i realtid för både BCC och FCC av kvalitet jämförbar kvalitet. v Acknowledgements I would like to thank my supervisor Elisabeth Linnér and reviewer Robin Strand for their great help and support. Thanks also to Fredrik Nysjö for taking a look at the shader code and answering my questions regarding GLSL. vii Contents 1 Introduction 1 1.1 Motivation ................................ 1 1.2 Why Voreen ............................... 2 1.3 Previous work .............................. 2 2 Background 3 2.1 The BCC and FCC grids ......................... 3 2.2 Direct volume rendering ........................ 3 2.2.1 Variants and enhancements .................. 5 2.3 Problem description ........................... 5 2.4 Raycasting in the BCC and FCC grids ................. 6 2.5 Reconstruction algorithms ....................... 6 2.6 Voreen’s architecture .......................... 6 3 Method and implementation 8 3.1 Steps provided by Voreen ........................ 8 3.2 Implementation ............................. 9 3.2.1 BCC DC-spline ......................... 11 3.2.2 FCC DC-spline ......................... 12 3.2.3 BCC linear box spline ..................... 15 3.2.4 BCC nearest neighbor ..................... 15 3.2.5 FCC nearest neighbor ..................... 15 3.3 Storage scheme ............................. 16 ix 3.3.1 Interleaved storage model ................... 16 3.3.2 Separate storage model ..................... 17 3.4 Gradient calculation ........................... 18 3.4.1 Inside Voreen .......................... 18 3.4.2 Externally ............................ 20 3.5 Module and processors ......................... 20 3.5.1 Step length compensation ................... 21 3.6 Utilities .................................. 21 3.7 Measuring performance ......................... 21 3.8 Measuring rendering quality ...................... 22 4 Results and discussion 25 4.1 Performance ............................... 25 4.2 Rendering quality ............................ 25 4.3 Discussion ................................ 30 4.3.1 Performance .......................... 30 4.3.2 Rendering quality ........................ 30 5 Conclusions 31 5.1 System requirements .......................... 31 5.2 Known issues .............................. 31 5.3 Future work ............................... 31 5.4 Conclusion ................................ 32 Appendices 36 A BCC fragment shader 36 B FCC fragment shader 39 x List of Figures 2.1 A BCC and an FCC voxel ........................ 4 2.2 Unit cells of the CC, BCC and FCC grid ................ 4 2.3 A minimal BCC raycasting network in Voreen ............. 7 3.1 Known and unknown values in the DC-spline model ......... 14 3.2 First order neighbors .......................... 19 3.3 Voreen network used for rendering quality analysis .......... 23 3.4 Example of images used in the rendering quality analysis ....... 24 4.1 CC and BCC performance comparison plot .............. 26 4.2 CC and FCC performance comparison plot .............. 27 4.3 Marschner-Lobb test signal renders .................. 28 4.4 Sphere rendering quality analysis plot ................. 29 xi List of Tables 3.1 Expensive operations of reconstruction algorithms .......... 9 3.2 Offsets of the Cartesian sub-grids ................... 10 3.3 Supported volume types in Voreen ................... 17 3.4 New volume types ............................ 18 xiii Acronyms BCC body centered cubic. xi, 1–10, 14, 16, 18, 19, 21–26, 28, 31, 32 CC Cartesian cubic. xi, 1–6, 9, 14, 19–22, 25–28, 30, 32 FCC face centered cubic. xi, 1–6, 8–10, 14, 16, 18, 19, 21, 22, 25, 27, 28, 31, 32 GPU graphics processing unit. 2, 5, 6, 8, 32 lerp linear interpolation. 8, 9, 32 RGBA red-green-blue-alpha. 5 RMSE root mean square error. 22 SOCD second-order central differencing. 18 xv Chapter 1 Introduction In visualization as well as many other areas of computational science, volumetric data is traditionally sampled and stored onto a Cartesian cubic (CC) grid. This data struc- ture is simple to handle and understand. Because it is so easily separable into two- dimensional or one-dimensional subsets, many things such as interpolation can be done by generalizing methods for lower-dimension Cartesian grids, e.g. the omnipresent two-dimensional Cartesian grid. Convenience, in other words, is among the biggest strengths of this type of grid. It has been shown however, that the sampling properties of the CC grid is far from op- timal in some settings. The body centered cubic (BCC) and face centered cubic (FCC) grids, three-dimensional grids corresponding to the two-dimensional hexagonal grid, has been shown to perform significantly better for band-limited signals. The results in [1] show that sampling such a signal onto a BCC grid provides the same visual quality when reconstructed with about 30% less sample points than the same signal sampled onto a CC grid. A downside of the non-Cartesian grids is their less than wide spread use, and therefore more limited tool support. In this thesis a module is developed for the volume rendering engine Voreen [2]. The module adds support for rendering both BCC and FCC volumes that can be used together with the feature rich framework Voreen provides. The performance and visual quality of the new raycasters and their different reconstruction methods is also measured and compared to the existing CC raycaster. 1.1 Motivation The purpose of this thesis is to create a simple tool for viewing data stored in BCC or FCC format in real time. The tool is aimed at anyone wishing to study and experiment with data in these grids. It is after all an important part of an experimental work flow to be able to see the results. 1 A known existing volume rendering framework is extended in hopes to make the tool flexible and accessible. The extension is made to fit in well with the other features of Voreen, and is therefore modeled after the existing Cartesian raycasters. Effort is also put into not interfering with other existing functionality when modifications have to be made. 1.2 Why Voreen Voreen was chosen as the platform previous to the start of this thesis work. It is a capable tool recommended by other scientists in this field. It is partially developed in Sweden, at Linköping University. Voreen’s web site [2] also states that it is designed to be flexible in allowing new visu- alization techniques to be integrated. It is written in C++ and has a well defined class hierarchy documented using Doxygen. For the user, Voreen also provides more than just standard raycasting. A variety of additional useful features