We are facing a problem of texture lookup problem.
We have a 1Dimensional texture of size 100 and as we know texture coordinates vary from 0.0 to 1.0. But as per chapter 24 of GPU Gems a texture coordinate can vary from 1 / (2100) to 1 - 1 / (2100) //Reference GPU Gems2 Page number387, 388. The calculation formula is ((1 - 1 / n) / n) where n is the size of texture. and
the interpolation type is LINEAR using GPU
When we try to look for texture coordinate having 10th value, the returned value differs from the actual 10th value. But if GPU interpolation is set as “POINT†then the correct value is returned.
As per the book GPU Gems2 the texture coordinate calculation is changed and the resulting formula is given above. Kindly notify us if any material regarding the above said issue is available. Also notify us if you have any concerns regarding the above assumptions or calculations.
And what exactly is the difference? If it’s a small fraction then it could be just precision problem. You could try to sample unfiltered texture at multiple points very close to each other to see if edge between two texels is exaclty where you expect it to be.
Also, make sure you do not have any anisotropic filtering or FSAA forced by your driver.
The calculation formula is ((1 - 1 / n) / n) where n is the size of texture.
That’s a constant. What do you do with it?
Assuming x is in the range [0,n-1], what you want is (0.5 + x) / n. In your example that would be (0.5 + x) / 100 for x in the range [0,99].
If your x is in the range [0,1] instead, you need (1-1/n) * x + 0.5 / n.