I am trying to simulate the behavior of "texelFetch()" and so far I've understood the following:
If "gvec4 texelFetch(gsampler3D sampler, ivec3 P, int lod)" is given then :
result = sampler * P
But what should I do with "lod"? Is it supposed to be used to scale the sampler?
I've read sufficient information about the purpose of lod/level-of-details/mipmapping level theoretically but I would like to understand the computation usage of it in the sampling process.
dFdx()
anddFdy()
function of the textureCoordinate variable to see, how the textureCoordinate vary in fragment shader stage... The important information in general is: What textureCoordinate has the neighboring pixel, to decide which LOD to use $\endgroup$texelFetch
theint lod
parameter is the selection of the mipmap, where 0 is the original image, 1 is the next smaller image and so on. $\endgroup$texelFetch
is concerned, thelod
value is simply an array index, and sampling proceeds as normal within the selected mip level. (BTW, I don't know what you mean by "result = sampler * P". A sampler is a data structure, not a number that you can multiply by...) $\endgroup$lod
fit into this computation for my implementation? I got the theory part but I'm trying to understand the mathematical aspect now $\endgroup$Sampler * lod
and then ` result = sampler * P ` ? $\endgroup$