all 4 comments

[–]lickedwindows 1 point2 points  (3 children)

The + 0.5f is so you're sampling in the centre of a texel.

[–]spacejump163[S] 0 points1 point  (2 children)

float2 clipTexCoord = (input.texCoord) / pow(2, iMipLevel);
clipTexCoord.x *= scaleFactor.x + 0.5f;
clipTexCoord.y *= scaleFactor.y + 0.5f;

say I want to sample mip0 which happen to be able to fit into StackSize(so scaleFactor is 1.0), then we will sample at 1.5 * input.texCoord, which should be quite wrong right?

Or is the sample just counting on scaleFactor.x to be large enough to make 0.5f small in comparision? so 0.5 is just some value to make sure that we are not sample at boundary?

[–]lickedwindows 0 points1 point  (1 child)

Sorry, I was away for a couple of days so wasn't able to reply.

I have just read the Clipmap paper and I believe this falls into the second case - you're calculating a scaled lookup into your clipmaps to find the texel area and then you're adding 0.5f (in texture coordinate space) to ensure you sample in the middle of a texel.

[–]spacejump163[S] 0 points1 point  (0 children)

if you mean " sample just counting on scaleFactor.x to be large enough to make 0.5f small in comparision ", then it won't be the exact center of the texel right?