<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2023-05-06T01:54:25.907Z
This answer blew my brains out.
aaaidan
CC BY-SA 4.0
2022-04-12T18:22:22.380Z
2022-04-12T18:22:22.380Z
Nathan Reed
<p>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.</p>
<p>I tried a simple application recently to try out reserved resource textures but I am having trouble understanding one situation in it.</p>
<p>test application details:rendering a full screen quad on a window via dx12.The quad is textured by a texture(reserved resource).</p>
<p>test cases:
1.
the texture used is large(5184X3456) and the mip auto selected is 2nd.</p>
<p>2.
the texture used is small(256X256) and the mip auto selected is 0th.</p>
<p>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.</p>

CC BY-SA 4.0
2022-04-12T14:44:45.103Z
"*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?
Nicol Bolas
<opengl><directx12><directx11>
mipmap selection process
VersesDev
# mipmap selection process

(Asked by: username_0 on 2022-04-12)

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.

**Tags:** opengl, directx12, directx11

> **Comments:**
> **username_1**: "*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?  

---

## 1 answers

### Answer by username_2 on 2022-04-12. Score: 4 | Accepted answer

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.

> **Comments:**
> **username_3**: This answer blew my brains out.  

---

