PDA

View Full Version : gl_Linear with 3d texture?



arthas
04-03-2008, 03:49 AM
Hi! I have a simple question... the parametr GL_LINEAR, returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. But even if the texture is 3d? or the average is made with 8 elements?

-NiCo-
04-03-2008, 04:35 AM
The latter,gl spec (http://www.opengl.org/registry/doc/glspec21.20061201.pdf) page 176.



Let

α = frac(u − 1/2)
β = frac(v − 1/2)
γ = frac(w − 1/2)

where frac(x) denotes the fractional part of x.
For a three-dimensional texture, the texture value τ is found as

τ = (1 − α)(1 − β)(1 − γ)τi0 j0 k0 + α(1 − β)(1 − γ)τi1 j0 k0
+ (1 − α)β(1 − γ)τi0 j1 k0 + αβ(1 − γ)τi1 j1 k0
+ (1 − α)(1 − β)γτi0 j0 k1 + α(1 − β)γτi1 j0 k1
+ (1 − α)βγτi0 j1 k1 + αβγτi1 j1 k1

where τijk is the texel at location (i, j, k) in the three-dimensional texture image