Which texel value is returned during Point sampling of the texture when more than one texels are at the equal distance?
Which texel value is returned during Point sampling of the texture when more than one texels are at the equal distance?
Which texel value is returned by the sampler during Point/Nearest neighbor sampling when more than one texels are at the equal distance?
Eg: In this case (after magnification) where for many pixels (or texture coordinates), 2 texels are at the same distance from its center. Which texel will be returned for the sampling of these pixels.
black dots = center of the pixel
yellow dots = center of the texel
1 Answer
1
From the OpenGL Wiki:
If GL_NEAREST is used, then the implementation will select the texel nearest the texture coordinate
So ultimately, the graphics card vendor decides what they consider the nearest texel.
A possible formula multiplies the texture coordinates by the image width / image height and rounds it down to get the texel index.
(i, j) = floor(uv * (width, height)),
where *
is component-wise multiplication.
*
The OpenGL implementation provided with the driver.
– Nico Schertler
Jul 1 at 20:45
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thank you, Nico. so picking nearest texel will depend on OpenGL API implementation (i.e. sampler in shader or sampler object) or graphics card implementation?
– user2259784
Jul 1 at 20:29