Incorrect result when using 3D textures

前端 未结 1 1376
耶瑟儿~
耶瑟儿~ 2020-12-21 13:47

I\'m using modern OpenGL 4.3 core.

I just realized that 1024p x 1024p tileset is too small for my needs. So, I replaced it with 1024p x 1024p x 4p 3D texture. (I kno

相关标签:
1条回答
  • 2020-12-21 14:44

    That's because 0 is the "leftmost" part of the left texel and 1 is the rightmost point in the rightmost texel. Assume we have 4 texels, than the coordinates are as follows:

    0       1/4      1/2      3/4       1
    |  tx1   |  tx2   |  tx3   |  tx4   |
    

    since you need to hit exactly the center of a voxel, you have to use addresses that are 1/2 voxel higher then you expected (+0.25/2 = +0.125), thus the voxel centers are as described in the bottom line of the following diagram.

    |  tx1   |  tx2   |  tx3   |  tx4   |
        |        |        |        |
      0.125    0.375     0.625    0.875
    
    0 讨论(0)
提交回复
热议问题