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 exists. Scripting, animation and image processing are some examples.
1.3 Previous work
Tools that render data in BCC and FCC grids are scarce other than the special pur- pose proof-of-concept implementations sometimes found together with publications in this area. An open source rendering software called vuVolume supports BCC and FCC through CC pre-conversion. It is however a non-interactive renderer that does not yet make use of graphics processing unit (GPU) acceleration. Furthermore, de- velopment in the public repository at http://sf.net/projects/vuvolume seemingly stopped in 2009.
2 Chapter 2
Background
2.1 The BCC and FCC grids
In a CC grid voxels are positioned at the intersection of equidistant, axis-aligned lines. The BCC or FCC grids can be seen as a composition of multiple such grids, interleaved and translated by an offset. This is just one of multiple ways that these non-Cartesian grids can be decomposed into simpler structures, but it is this model that is used for the techniques in this thesis. In this model, if the inter-voxel distance (grid spacing) of a CC grid is ℎ, the BCC grid contains two such grids with the second being translated by , , in relation to the first. An FCC grid can be built using four ℎ-spaced CC grids with the last three being translated by 0, , , ,0, and , , 0 in relation to the first. The Voronoi region of a point (the region where the point is the nearest) in a Cartesian grid is a square box. The voxels are therefore shaped like square boxes, a cube even, if the grid is equally spaced in all dimensions. In a BCC grid it instead takes the shape of a truncated octahedron, and for FCC a rhombic dodecahedron. What these geometric shapes look like can be seen in Figure 2.1. The repeating structure of nearby points for the grids known as their unit cells, can be seen in Figure 2.2.
2.2 Direct volume rendering
A volumetric data set can be rendered as an image using so called direct volume ren- dering. The technique is direct, as in samples are directly extracted and shaded to pro- duce an image as opposed to fitting geometric primitives to the sampled data before rendering. Direct volume rendering can be done efficiently using the programmable
3 Figure 2.1: A BCC and an FCC voxel
(a) Unit cell of the CC grid (b) Unit cell of the BCC grid (c) Unit cell of the FCC grid
Figure 2.2: Unit cells of the CC, BCC and FCC grid
4 shader support in modern graphics cards, which is the variant that is used and de- scribed in this thesis. The algorithm casts a ray through every pixel on the projection surface into the scene, sampling at a finite set of points along it. The samples are then converted into colors and finally composited to create the final pixel value seen in the rendered image. The mapping between the scalar values in the volume to colors is done using a transfer function. Generally this function maps what is stored in the volume (often intensity) to a red-green-blue-alpha (RGBA) quadlet. It is possible to omit the transfer function step if such color values are already stored in the volume. The compositing step then merges the sampled colors into one using some type of blending, e.g. alpha blending [3].
2.2.1 Variants and enhancements
Enhancements to the basic algorithm have been invented that can improve both im- age quality and performance. Performance-wise, as most of the computation time is usually spent sampling the data set, this activity should be minimized. One can stop sampling values as soon as the alpha of the current composited color equals or exceeds a threshold, as further sampling does not contribute to the final pixel value. This tech- nique known as early ray termination [3], can be used by raycasters in Voreen.
2.3 Problem description
The first step is to find one or more appropriate reconstruction methods that can be implemented on the GPU and in Voreen efficiently enough that the requirement of interactiveness can be met. The reconstruction quality should be as good as possible given this performance constraint. Secondly, a decision has to be made on what way to interleave, layer or otherwise store the BCC and FCC data. Creation of tools to generate data in this format are also required. Which storage scheme that is most appropriate will depend on the access pattern of the selected reconstruction algorithm or algorithms. Thirdly, new raycasters must be implemented in Voreen that utilize the BCC- and FCC reconstruction methods. As many of the existing tools available in Voreen are grid agnostic, it is useful to maintain compability with them. The raycasters should therefore exist in harmony with the rest of the framework as much as possible. When implemented, the performance and image quality of the new raycasters and their different reconstruction modes is to be measured, the results presented with a comparison to the existing CC raycaster.
5 2.4 Raycasting in the BCC and FCC grids
When performing GPU accelerated raycasting in a regular CC grid, the hardware can implicitly reconstruct the signal linearly by simply setting the proper texture filtering mode. This form of interpolation which is implemented on all recent GPUs, is called trilinear interpolation. Graphic cards are designed to minimize the cost of the eight texture lookups required, making it nearly as fast as a nearest neighbor lookup on most hardware [4]. The trilinear lookup is however only directly usable for CC data. For data not arranged in this structure, like the case with BCC and FCC, a custom reconstruction algorithm has to be used. For such custom algorithms, using several nearest neighbor lookups per sample is often nessecary.
2.5 Reconstruction algorithms
For the module developed in this thesis, two reconstruction algorithms are selected for implementation. The DC-spline algorithm by B. Domonkos et al. in [5] for BCC and FCC, and the linear box spline for BCC by B. Finkbeiner et al. in [6], later extended in [7]. Both methods are designed for implementation on the GPU. The DC-spline method uses the fact that trilinear texture lookups are accelerated and shows good performance despite requiring five trilinear texture lookups. The linear box spline uses non-interpolated lookups but requires only four of them. The render- ing quality of the two filters is compared by Domonkos et al. in [8] and is concluded to be quite similar. Both methods promise acceptable performance, image quality and do not require the data to be pre-processed to interpolate. The higher order variants that exists for both methods are not implemented due to the constraint of performance. While a box spline method for the FCC grid has been presented in [9] by M. Kim et al., it is more computationally expensive and is not designed for the GPU. It is therefore not chosen for implementation.
2.6 Voreen’s architecture
Voreen divides the process of turning a volumetric data set into an image into mul- tiple simpler processing stages. The tasks in these stages are performed by pluggable components called processors. The user connects processors by linking their inputs and outputs together. The resulting graph of connected processors is called a net- work. Components within a network starts processing when their output is required by another processor.
6 Figure 2.3: A minimal BCC raycasting network in Voreen
In addition to their input and outputs, processors can also have properties linked to each other. Properties are user changeable settings that affect the way that data is interpreted and processed, such as camera settings and light position. It is often useful to link properties together when performing compositing or comparisons of images. An example network containing a minimal raycasting setup using the new BCC pro- cessor can be seen in Figure 2.3. Except for a small set of core functionality, the entirety of Voreen’s components are contained in loadable modules. The base module contains the most basic components, such as the VolumeSource, Canvas and Single/MultiVolumeRaycaster processors. An- other useful module that ships with Voreen are for example the python module that provides the user with a Python API that has access to processors and their proper- ties as well as some of Voreen’s internals. This is used to measure performance in section 4.1 and to perform the error analysis in section 4.2.
7 Chapter 3
Method and implementation
In the GPU based implementation of the DC-spline method for BCC proposed in [5], the algorithm uses a total of six trilinear texture lookups and five linear interpolation (lerp) instructions. Generalized for the FCC grid it requires sixteen trilinear texture lookups and eight lerps. The linear box spline reconstruction technique for BCC both described and imple- mented in [7] is also adapted and included. It requires four nearest-neighbor texture lookups. Nearest-neighbor algorithms are also implemented for both BCC and FCC. These simple interpolation methods do well in terms of performance, but understandably worse than the others in terms of visual quality. Despite this they can be useful in some experiments and used as a reference during development in Voreen. An overview of the reconstruction algorithms is in Table 3.1.
3.1 Steps provided by Voreen
In a Voreen network such as the one in Figure 2.3 the basic setup for performing ray- casting is already provided. In a typical ray casting network, the VolumeSource pro- cessor loads the volume file and generates an OpenGL three-dimensional texture. The CubeMeshProxyGeometry then sets up a cube with the correct proportions based on the loaded volume connected to its input port. The MeshEntryExit points then ren- ders the inside and outside of this cube to separate textures available on its output ports. These textures are then used by the raycaster to form entry and exit points for the casted rays, a well known method for raycasting volumes using shaders [3]. Thus, the raycaster only needs to bind all the textures and produce an output image using a fragment shader. The rendering algorithm in this shader is a typical ray traver- sal loop. An entry and exit point is extracted at the position of the current pixel in the
8 Table 3.1: Number of expensive operations performed in the implementations of the different reconstruction algorithms
Method Lerps Lookups CC trilinear 0 1 CC nearest neighbor 0 1
BCC nearest neighbor 0 1 BCC linear box spline 0 4 BCC DC-spline 5 6
FCC nearest neighbor 0 1 FCC DC-spline 7 16
entry and exit textures. These are then used to form direction vector for the ray, which is then traversed using the configured step size. The produced image can then be ob- served by connecting the output image port of the processor to a Canvas processor.
3.2 Implementation
This section describes the concrete implementations, step by step, used for the cho- sen reconstruction methods. It attempts to describe the adapted algorithm, including how texture accesses are performed in the shared volume format. The relevant GLSL fragment shader code can be found in Appendix A and Appendix B.
• [⋅] denotes the nearest integer function.
• lerp(푎, 푏, 훼) denotes a linear interpolation, defined as (1 − 훼)푎 + 훼푏.
• 푓 (푥, 푦, 푧) denotes a nearest neighbor lookup at a known point in sub-grid tex- ture 푛.
• lin (푥, 푦, 푧) denotes a trilinear texture lookup at (푥, 푦, 푧) in sub-grid texture 푛.
• Δ is the sub-grid offset constant for grid 푛, listed in Table 3.2.
9 Table 3.2: Offsets of the Cartesian sub-grids
BCC FCC Symbol (BCC) Symbol (FCC) % % Δ (0, 0, 0) (0, 0, 0) U u% Δ ( , , ) (0, , ) U Δ – ( , 0, ) – E% Δ – ( , , 0) –
Algorithm 1 Find the nearest BCC % and U points from 퐩
퐚 ← ([푝 ], [푝 ], [푝 ]) 퐛 ← ([푝 − ], [푝 − ], [푝 − ]) + ( , , ) return (퐚, 퐛)
Algorithm 2 Find the nearest FCC % , U , u% and E% points from 퐩
퐚 ← ([푝 ], [푝 ], [푝 ]) 퐛 ← ([푝 ], [푝 − ], [푝 − ]) + (0, , ) 퐜 ← ([푝 − ], [푝 ], [푝 − ]) + ( , 0, ) 퐝 ← ([푝 − ], [푝 − ], [푝 ]) + ( , , 0) return (퐚, 퐛, 퐜, 퐝)
10 3.2.1 BCC DC-spline
To interpolate the signal in a point 퐬:
1. Find the closest % and U to 퐬, call them 퐚 and 퐛 using Algorithm 1.
2. Find a transformation matrix 푀 that takes us to the standard case where 퐛 = 퐚 + , , , seen in Figure 3.1(a). To avoid branching, it is defined by applying the sign function (sgn) on the dif- ference of 퐚’s and 퐛’s coordinates
sgn(푎 − 푏 ) 0 0 ⎛ ⎞ 푀 = 0 sgn(푎 − 푏 ) 0 ⎝ 0 0 sgn(푎 − 푏 ) ⎠
3. Interpolate the signal in the unknown corner points of the cube. 1 푓(퐩̃ ) = lerp 푓 (퐩 − Δ ), 푓 (퐩 − Δ ), = lin 퐩 − Δ 2 1 푓(퐩̃ ) = lerp 푓 (퐩 − Δ ), 푓 (퐩 − Δ ), = lin 퐩 − Δ 2 1 푓(퐩̃ ) = lerp 푓 (퐩 − Δ ), 푓 (퐩 − Δ ), = lin 퐩 − Δ 2 1 푓(퐩̃ ) = lerp 푓 (퐩 − Δ ), 푓 (퐩 − Δ ), = lin 퐩 − Δ 2
where 1 퐩 = 푀 퐚 + (푥, 푦, 푧) 2
4. Using these interpolated values, interpolate the signal in the corner points of the dotted quad 퐬 lies in.
̃ ̃ ̃ 푓(퐪 ) = lerp 푓(퐩 ), 푓(퐩 ), 2|푠 − 푏 | ̃ ̃ ̃ 푓(퐪 ) = lerp 푓(퐩 ), 푓(퐩 ), 2|푠 − 푏 | ̃ 푓(퐪 ) = lerp 푓 (퐩 − Δ ), 푓 (퐩 − Δ ), |푠 − 푏 |
= lin (푎 , 푠 , 푎 ) − Δ 1 푓(퐪̃ ) = lerp 푓 (퐩 − Δ ), 푓 (퐩 − Δ ), |푠 − 푏 | + 2
= lin (푏 , 푠 , 푏 ) − Δ
11 5. Finally, bilinearly interpolate the signal in 퐬 using the values interpolated at the quad’s corner points in step 4. ̃ 푓(퐬) = lerp(lerp(퐪 , 퐪 , |푠 − 푎 |), lerp(퐪 , 퐪 , |푠 − 푢 |), |푠 − 푎 |)
The relevant part of the GLSL shader source code implementing this can be seen in Appendix A.
3.2.2 FCC DC-spline
To interpolate the signal in a point 퐬:
1. Find the nearest % , U , u% and E% from 퐬 and call them 퐚, 퐛, 퐜 and 퐝 respec- tively, using Algorithm 2.
2. Find a transformation matrix 푀 that takes us to the standard case seen in Fig- ure 3.1(b). To avoid branching, it is defined by applying the sign function (sgn) on the dif- ference of the nearest known point coordinates
sgn(푏 − 푎 ) 0 0 ⎛ ⎞ 푀 = 0 sgn(푐 − 푎 ) 0 ⎝ 0 0 sgn(푑 − 푎 ) ⎠
3. Interpolate the signal in the unknown points.
12 1 1 푓(퐩̃ ) = lerp 푓(퐩 ), 푓(퐩 ), 3 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 = lin 퐩 − Δ + lin 퐩 − Δ + lin 퐩 − Δ 3 1 1 푓(퐩̃ ) = lerp 푓(퐩 ), 푓(퐩 ), 3 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 = lin 퐩 − Δ + lin 퐩 − Δ + lin 퐩 − Δ 3 1 1 푓(퐩̃ ) = lerp 푓(퐩 ), 푓(퐩 ), 3 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 = lin 퐩 − Δ + lin 퐩 − Δ + lin 퐩 − Δ 3 1 1 푓(퐩̃ ) = lerp 푓(퐩 ), 푓(퐩 ), 3 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 + lerp 푓(퐩 ), 푓(퐩 ), 2 1 = lin 퐩 − Δ + lin 퐩 − Δ + lin 퐩 − Δ 3
where 1 퐩 = 푀 퐚 + (푥, 푦, 푧) 2 4. Using these interpolated values, interpolate the signal in the corner points of
13 q0,1
q0,1 q1,1 q1,1
s s q0,0
q0,0 q1,0 p0,0,0 q1,0 p0,0,0 z y x (a) BCC (b) FCC
Figure 3.1: Known (black and white) and unknown (grey) values of the expanded CC grid in standard orientation
the quad.
̃ ̃ 푓(퐪 ) = lerp 푓(퐩 ), 푓(퐩 ), 2|푝 − 푎 | ̃ ̃ 푓(퐪 ) = lerp 푓(퐩 ), 푓(퐩 ), 2|푝 − 푎 | ̃ 푓(퐪 ) = lerp 푓(퐩 ), 푓(퐩 ), 2|푝 − 푎 | ̃ ̃ 푓(퐪 ) = lerp 푓(퐩 ), 푓(퐩 ), 2|푝 − 푎 |
5. Finally, bilinearly interpolate the signal in 퐬 using the quad’s corner values cal- culated in step 4. ̃ 푓(퐬) = lerp(lerp(퐪 , 퐪 , |푎 − 푠 |), lerp(퐪 , 퐪 , |푎 − 푠 |), |푎 − 푠 |)
The relevant part of the GLSL shader source code implementing this can be seen in Appendix B.
14 3.2.3 BCC linear box spline
The GLSL implementation by Finkbeiner et al. in [7] can be adapted with only some slight modifications. As the storage model used by their method differs from the one used in this project, the data access needed to be adapted. In the model used for their algorithm, the Cartesian grid spacing is 2. In such a model, a % point have all odd coordinates, while a U point have all even coordinates. A lookup must be directed to the correct sub-grid texture. A simple translation and selection of texture is made by first scaling the point of interest’s coordinates by 2 before interpolating.
퐒 = 2퐬
When a point 퐏 is to be sampled, the correct sub-volume can be chosen based on the parity of any of its coordinates.