VolumeRendering
3D Texture Interpolation (Nearest-Neighbour)
← Marble Example | ● | 3D Texture Interpolation Trilinear →
A volume is given with the dimensions $w, h, d$ (in voxels). The voxel value of the i-th column, j-th row and k-th slice is given by V(i,j,k). This equals the (i+w(j+kh))-th element in the linear memory layout.
Then the data value at normalized texture coordinate $(s,t,r)\in[0,1]$ is determined via Nearest-Neighbour Interpolation of voxels $V(i,j,k)$ at the index:
$\displaystyle{ i=\lfloor s\cdot(w-1)+\frac12\rfloor }$
$\displaystyle{ j=\lfloor t\cdot(h-1)+\frac12\rfloor }$
$\displaystyle{ k=\lfloor r\cdot(d-1)+\frac12\rfloor }$
The scalar function is therefore:
$\displaystyle{ f(s,t,r) = }$
$\displaystyle{ V(\lfloor s\cdot(w-1)+\frac12\rfloor, }$
$\displaystyle{ \lfloor t\cdot(h-1)+\frac12\rfloor, }$
$\displaystyle{ \lfloor r\cdot(d-1)+\frac12\rfloor) }$