Mon, 21 Sep 2009 04:02:00 +0200 schrieb Skybuck Flying:
> Lineair probably means no subpixeling/subtexeling it rounds to nearest
> real texel.
>
> Bi-linear... not sure it might take two coordinates/texels and take the
> average color of that.
>
> Tri-linear... is probably three coordinates around the text coordinates
> and takes the avage color of those three texels.
>
> When dealing with gpgpu programming this interpolating feature might not
> be desired... so setting it to lineair might give best results... though
> the texture coordinates should end up on texels anyway.. but still...
> using anything else might give slight floating point drift... or if
> coordinates are of by 0.5 might screw it badly... so it seems wise thing
> to do... though enabling this interpolating stuff could indicate if the
> coordinates are proper or inproper 
>
> That's my theory at least !
No. Normally (in the context of modern gpu rendering), even plain
textures are 3D pyramidal objects, when they are mipmaped (the normal
picture plus serveral downsampled versions). Mipmapping is mainly used
to improve image quality, but also to lower memory bandwith consupmtion,
of course.
Shaders normally only need two address 2 dimensions (the hardware
then automatically derives the mip-level to use).
For mipmapped 2D image textures, linear and bilinear filtering
is the same thing. The resulting color is lineary interpolated
from a square of 4 pixels:
result = ( fx) * (fy*c0 + (1-fy)*c1)
+ (1-fx) * (fy*c2 + (1-fy)*c3);
where fx and fy are the fractions [0..1] of the texture adresses
and c0..c3 are the texture contents.
In this case (linear or bilinear) filtering, only one mipmap-level
of the texture is sampled.
Trilinear filtering then adds a linear interplotation with one more
mip-map level, giving smoother miplevel transitions.
One problem with this linear filtering is that there only exists
one mipmap-level "z" coordinate. Everything is fine as long as
the textured surface is parallel to the screen and rendered
evenly scaled. If it is not, then the hardware won't have a
chance to choose a good mip-level for the texture fetch using
above mentioned methods (one of the xy coordinates will change
much faster then the other with respect to screenspace
[change per pixel]). The hardware also accelerates anisotropic
texture filtering for this reason. This kind of filtering
does something similar to the linear filtering, but separetly
takes the rate of x and y changes per fragment into account
(by blending even more texels).
The thing you wre talking about (fetching nearest point) is
called "point sampling", or simply "no filtering".
Gruss
Jan Bruns