|
|
On 8 Mar 2002 15:47:01 -0500, Ron Parker wrote
>>> and see the difference between the two images. The interpolated version
>>> shows a shifted texture image. I think it would be correct it the
>>> interpolation would take the middle of each texel (texture bitmap pixel)
>>> instead of a texel's corner.
>>
>>> Is this a bug or a feature?
>>
>> AFAIK, feature.
>> 3D-cards do the same. Probably also most other renderers.
>
> There are (or were) some bugs in interpolation. I don't remember whether
> we've gotten around to fixing them or not.
I checked with POV 3.5 Beta 12 (Win32), it's the same behaviour.
@Warp: I disagree. I thought about it and came to the conclusion that
it is a bug. Let me explain why.
I don't know if current hardware really does this the way it's
specified in the OpenGL specs (I did not check), but at least the
specs state very clearly how to interpolate texel colors, so I
assume 3D cards will do it as specified.
The OpenGL spec says (In Section 3.8.7 of the 1.3 spec):
----
When the interpolation mode is set to GL_LINEAR (linear interpolation),
the color to be used for some texture coordinates (u,v) is determined
by these equations:
Let T[i,j] be the color of a texel at coordinates i,j.
Let floor(x) be the largest integer not greater than x, in other words,
the normal C function floor().
Let frac(x) be x-floor(x). This means that frac(x) is never negative.
i=floor(u-1/2)
j=floor(v-1/2)
a=frac(u-1/2)
b=frac(v-1/2)
t=(1-a)*(1-b)*T[i ,j ]
+ a *(1-b)*T[i+1,j ]
+(1-a)* b *T[i ,j+1]
+ a * b *T[i+1,j+1]
t is the final color resulting from the interpolation.
----
These equations have the following properties:
i) For the center of a texel (where frac(u)=frac(v)=0.5) the
final color is the texel's color, and nothing else.
ii) For the point where four texels meet (where frac(u)=frac(v)=0) the
final color is the sum of the four texel's colors, weighted with 0.25.
In POV-Ray this is not true. The mapping is shifted by half a texel in
u and v.
--
Timon Christl <chr### [at] fmiuni-passaude>
Post a reply to this message
|
|