texture memory addressing


i a have a basic question about addressing texture memory, in the case of

tex3D(texref, x, y, z);

do i have to add 0.5f like

tex3D(texref, x+0.5f, y+0.5f, z+0.5f);

to every coordinate, to address the desired element? i read about it in some other threads, but it doesn’t make a lot of sense to me…

hope somebody knows about that…

you should carefully read E.2 section in cuda programming guide to understand how filtering works in detail.
The only reason I can see when you would want to add 0.5f to non-normalized texture coordinates (or 0.5/texdim in case of normalized addressing) is to get exactly the value of that sample regardless of interpolation mode set. If you do not add 0.5, then you will get (T[x-1]+T)/2 with linear interpolation. Again, section E.2 explains the details.

I for example use texture memory for fast interpolation in image registration, and then I have to add 0.5f for the algorithm to converge.

i don’t want interpolated values, i want the exact values at the coordinates (x,y,z), and i read in multiple posts, that people would address them with adding 0.5f to each coordinate…