Tricubic Interpolation?

I have a voxel (8 verticies) with a grey scale value at each vertex. How do I get OpenGL to render polygons withing the voxel.
I’d like to start at the top of the cube and render slices within it. I am hoping that OpenGL will do the interpolated shading between verticies…

Store the grey scales in a 3D texture (glTexImage3D). The 3D texturing with linear filters will do the interpolaton on the sclices for you.

That’s not entirely true. It will filter in the directions parallel to the primitive, but not perpendicular. You could use fragment programs (or perhaps something simpler) to get filtering in the third dimension.

Incidentally, this would be trilinear filtering because the filter kernels are still first order. Unfortunately, this name conflicts with trilinear filtering over MIP-maps, but algorithmically, they are the same. Trilinear MIP-map filters through an image pyramid instead of an image volume, so it doesn’t really help.

For a filter to be called “cubic” the interpolation function would need to be a third order polynomial.


I am under the impression that linear filtering in a 3D texture actually samples all 8 points, just like linear filtering in a 2D texture samples the 4 surrounding points.

Anyway, if you want to render a density cloud or something like that, drawing a single polygon isn’t going to cut it. OpenGL doesn’t do volumetric rendering (because no mainstream hardware does that).

I was a bit hasty in contradicting Relic. OpenGL WILL certainly perform filtering across the 8 texels as you suggest.

The problem that I was talking about has to do with the slices themselves. If your slices are further than 1 or 2 texels apart, you can get aliasing in the direction perpendicular to your sampling planes.