From Ohm

3D Texturinterpolation (Trilinear)

The data value at normalized texture coordinates $(s,t,r)\in[0,1]$ is determined via Tri-linearer Interpolation of 8 corner values $P_{000}...P_{111}$:


at the index (of the left front bottom corner of the bounding voxel)

$i=\lfloor s\cdot(w-1)\rfloor$
$j=\lfloor t\cdot(h-1)\rfloor$
$k=\lfloor r\cdot(d-1)\rfloor$

Then the three linear interpolation weights $u,v,w\in[0,1]$ are:

$u = s\cdot(w-1) - \lfloor s\cdot(w-1)\rfloor$
$v = t\cdot(h-1) - \lfloor t\cdot(h-1)\rfloor$
$w = r\cdot(d-1) - \lfloor r\cdot(d-1)\rfloor$

The tri-linear interpolation equals three subsequent linear interpolations along the x-axis (red), the y-axis (green) and the z-axis (blue). The resulting interpolated function value is depicted in yellow.

The function value is therefore:

$\displaystyle{ f(u,v,w) = }$
$\displaystyle{ (1-w)((1-v)((1-u)P_{000}+uP_{100}) + }$
$\displaystyle{ v((1-u)P_{010}+uP_{110})) + }$
$\displaystyle{ w((1-v)((1-u)P_{001}+uP_{101}) + }$
$\displaystyle{ v((1-u)P_{011}+uP_{111})) }$

Retrieved from

Page last modified on November 05, 2013, at 10:14 AM