0
$\begingroup$

I wished to understand which mip map in the chain of mips is selected upon sampling a texture.Which factors it depends on.I know that it depends on the area of the texture visible.

I tried a simple application recently to try out reserved resource textures but I am having trouble understanding one situation in it.

test application details:rendering a full screen quad on a window via dx12.The quad is textured by a texture(reserved resource).

test cases: 1. the texture used is large(5184X3456) and the mip auto selected is 2nd.

2. the texture used is small(256X256) and the mip auto selected is 0th.

both the textures contains full mip chain and nothing other than the size of texture is changing here so why is larger one using 2nd mip rather 0th like smaller tex(I am rendering both of them on a full screen quad).Is the size of texture also a factor in auto mip selection? Sampler used is same in both the cases:D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT.

$\endgroup$
1
  • $\begingroup$ "I know that it depends on the area of the texture visible." Why is that not good enough? If you draw a larger texture over the same size area, won't less of the texture area be visible? $\endgroup$ Apr 12 at 14:44

1 Answer 1

2
$\begingroup$

Mipmap selection is done by looking at adjacent pixels on the screen, and finding how far apart their texture samples fall. The mip level is chosen so as to make the space between adjacent texture samples approximately 1 texel.

For example if you have a 4K texture and display it 1K wide on the screen, then adjacent pixels will be sampling points 4 texels apart (at the base mip), and so the hardware will choose mip level 2 (which is 1/4th the resolution). At mip level 2, the sample points are 1 texel apart.

Conversely, if you have a 256×256 texture and display it 1K wide, then adjacent pixels will be sampling points only 0.25 texels apart. In this case, since the spacing is less than 1 texel it will use mip level 0.

So, it's not really about either the size of the texture or the area of texture that's visible, at least not directly. It's about the ratio of texels to pixels.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.