2D texture is distorted when performing subpixel translation

I would like to know the theoretical background why this is possible: how the translation of geometry is related to the display of textures.

  • I can notice this effect only when performing subpixel translation, the texture looks great if it is translated to the entire pixel (s).
  • I use orthographic projection, GL_CLAMP_TO_EDGE, GL_NEAREST, fragment shader highp.
  • The texture coordinates are subregions of the atlas, but I see distortion even if the entire atlas is displayed.
  • Using OpenGL ES (Android and iOS), but please, before remapping, someone can explain that this is not a problem in OpenGL.

Things I tried:

+3
source share
1 answer

Moving through subpixel sums will always change the texture selection. The fact that you use the closest selection affects the texture selection, but not the coordinate in which it is executed in the first place. This coordinate is a function of both tex-coords interpolated over the polygon and vertices that determine how the polygon is rasterized to display pixels.

Remember that in order to get the perfect texture selection, the interpolated tex coordinates, when they are estimated at the centers of the pixels, must lie exactly on the texel centers.

Moving the polygon to a part of the pixel on it changes where the texture is selected, since the centers of the pixels now lie at a slightly different point inside the polygon.

, , , , , , , . , , , , , .

. , , - .

, . ( ), , .

, , 1:1, . .

, , , , , , . , , . , .

Diagram showing texture sampling

+7

All Articles