<p>Minification vs magnification is an extension of mipmap selection. When you calculate the desired mip level, it can come out to be less than 0 (or in general, less than the sampler's configured minimum LOD). In that case you're doing magnification of the lowest mip level. If the desired level comes out to a value greater than 0 then you're doing minification.</p>
<p>Mipmap selection works by calculating differences of the UV coordinates between adjacent pixels on screen (see <a href="http://www.aclockworkberry.com/shader-derivative-functions/" rel="nofollow noreferrer">shader derivative functions</a>). Since the GPU is always shading pixels in 2×2 quads, it can look at the set of UVs input to the sampling operation across all those pixels. Those derivative vectors establish what the pixel footprint in texel space is, and their lengths are used to calculate which mip level to sample.</p>
<p>The details of how these calculations work exactly can be found in <a href="https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf#section.8.14" rel="nofollow noreferrer">the OpenGL spec, section 8.14 &quot;Texture Minification&quot;</a></p>

CC BY-SA 4.0
2020-12-01T20:55:22.450Z
2020-12-01T20:55:22.450Z
Nathan Reed
<p>Let me first state what I think I know and please correct me if I'm too inaccurate or plainly wrong.</p>
<p>When you use a function like <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/texture.xhtml" rel="nofollow noreferrer">texture</a>, you're requesting a texel value given a pair (u,v) of texture parameters. However, depending on the pixel size / texel size ratio, there's a filtering and resampling prior to returning the texel value, which you can actually configure in the corresponding API (OpenGL, Vulkan, etc).</p>
<p>As I understand it, this filtering and resampling occurs because either:</p>
<p>a) Many texels affect a pixel. This happens because the texture resolution is too high for the area on screen to be covered (i.e. the pixel resolution). So in order to avoid artifacts, the texture needs to be downsampled, which consists of applying a minification filter and resampling at a lower rate.</p>
<p>b) The same texel can affect many pixels. The texture resolution is lower than the pixel resolution. In this case, a magnification filter is used and the texture is upsampled.</p>
<p>Assuming the above explanations are correct, my question is: how does the GPU know which of these two scenarios are happening.</p>
<p>I reckon that it does by projecting the pixel area in texture space, as it is done for selecting the mipmap level. But even if that's the answer, how is this projection achieved? I'm failing to visualize it.</p>

<texture><sampling><filtering>
How does the GPU know whether to magnify/minify?
Francis Moy
# How does the GPU know whether to magnify/minify?

(Asked by: username_0 on 2020-12-01)

Let me first state what I think I know and please correct me if I'm too inaccurate or plainly wrong.

When you use a function like [texture](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/texture.xhtml), you're requesting a texel value given a pair (u,v) of texture parameters. However, depending on the pixel size / texel size ratio, there's a filtering and resampling prior to returning the texel value, which you can actually configure in the corresponding API (OpenGL, Vulkan, etc).

As I understand it, this filtering and resampling occurs because either:

a) Many texels affect a pixel. This happens because the texture resolution is too high for the area on screen to be covered (i.e. the pixel resolution). So in order to avoid artifacts, the texture needs to be downsampled, which consists of applying a minification filter and resampling at a lower rate.

b) The same texel can affect many pixels. The texture resolution is lower than the pixel resolution. In this case, a magnification filter is used and the texture is upsampled.

Assuming the above explanations are correct, my question is: how does the GPU know which of these two scenarios are happening.

I reckon that it does by projecting the pixel area in texture space, as it is done for selecting the mipmap level. But even if that's the answer, how is this projection achieved? I'm failing to visualize it.

**Tags:** texture, sampling, filtering


---

## 1 answers

### Answer by username_1 on 2020-12-01. Score: 2 | Accepted answer

Minification vs magnification is an extension of mipmap selection. When you calculate the desired mip level, it can come out to be less than 0 (or in general, less than the sampler's configured minimum LOD). In that case you're doing magnification of the lowest mip level. If the desired level comes out to a value greater than 0 then you're doing minification.

Mipmap selection works by calculating differences of the UV coordinates between adjacent pixels on screen (see [shader derivative functions](http://www.aclockworkberry.com/shader-derivative-functions/)). Since the GPU is always shading pixels in 2×2 quads, it can look at the set of UVs input to the sampling operation across all those pixels. Those derivative vectors establish what the pixel footprint in texel space is, and their lengths are used to calculate which mip level to sample.

The details of how these calculations work exactly can be found in [the OpenGL spec, section 8.14 "Texture Minification"](https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf#section.8.14)


---

