<p>You might find the 1983 paper that introduced this**, i.e. <a href="https://classes.soe.ucsc.edu/cmps160/Fall05/papers/p1-williams.pdf" rel="nofollow noreferrer">Lance Williams' "Pyramidal Parametrics"</a> informative.  </p>

<p>You can ignore the scheme, in Figure 1, he used for the layout of the MIP maps as I doubt any hardware, at least in the last 20+ years, used that approach.</p>

<p>** <em>(Actually, Williams *may* have described the technique at an earlier SIGGRAPH (1981) as part of tutorial/course but I've never been able to get hold of a copy)</em></p>

CC BY-SA 3.0
2017-03-03T22:09:16.563Z
Fantastic reference. Always fascinating to read original papers which introduced new technologies that we all but take for granted these days.
Dan
CC BY-SA 3.0
2017-03-03T12:44:18.320Z
2017-03-03T14:43:59.700Z
2017-03-03T14:43:59.700Z
Simon F
<p>It's called <a href="https://en.wikipedia.org/wiki/Trilinear_interpolation" rel="noreferrer">trilinear interpolation</a>. You first do a bilinear interpolation of the higher-res texture, then do a bilinear interpolation on the lower-res texture, then interpolate between the 2 results. The weight of the final interpolation is based on where between the 2 textures your Z-coordinate falls. If 0 is fully the low-res texture and 1 is fully the high-res texture, then you can use the standard glsl <code>mix()</code> function to combine the two:</p>

<pre><code>result = (highres texture color * weight) + (lowres texture color * (1.0 - weight));
</code></pre>

CC BY-SA 3.0
2017-03-03T00:30:08.370Z
You are talking about GL_LINEAR_MIPMAP_LINEAR filtering method, but if you use GL_NEAREST_MIPMAP_LINEAR instead then you first do a nearest interpolation of the higher-res and lower-res textures, and then mix the resulting colors giving more preference to the nearest mipmap and less preference to the furthest. Am I correct?
Adrian
CC BY-SA 3.0
2017-03-03T00:51:02.213Z
Actually, for nearest, you would just pick either the high res or low res texture (which ever is nearest), and then within that texture do a normal 2D nearest-neighbor look-up.
user1118321
CC BY-SA 4.0
2022-01-15T17:45:31.060Z
For GL_NEAREST_MIPMAP_NEAREST we pick the nearest mipmap and applies nearest filtering to that. Since it renders very differently to simply using GL_NEAREST for texture minification I can only assume that GL_NEAREST lazily picks whichever mipmap is "good enough" (maybe you can provide clarification?).
alexpanter
CC BY-SA 4.0
2022-01-15T17:48:14.317Z
With mipmap interpolation we have 2 parameters: mipmap selection and interpolation. For mipmap selection it's decided by GL_xxx_MIPMAP_selection, and for interpolation it's decided by GL_interpolation_MIPMAP_xxx. So in that sense only GL_LINEAR_MIPMAP_LINEAR is truly a trilinear filtering method. (If I understand corrrectly)
alexpanter
CC BY-SA 3.0
2017-03-02T23:52:29.450Z
2017-03-02T23:52:29.450Z
user1118321
<p>Nearest interpolation between 2 texels means to take the texel whose center is nearest to a given coordinate to draw or, in other words, the texel the coordinate is matching.</p>
<p>Linear interpolation between 2 texels means to mix the colors of them using more of the nearest texel and less of the others according to the distance to a certain coordinate.</p>
<p>Nearest interpolation between 2 mipmap levels consist in taking the mipmap whose size fits better the size of the image to draw</p>
<p>But I cannot understand how linear interpolation works with mipmap levels.</p>

<opengl><image-processing><image>
How linear interpolation works between mipmaps?
Adrian
# How linear interpolation works between mipmaps?

(Asked by: username_0 on 2017-03-02)

Nearest interpolation between 2 texels means to take the texel whose center is nearest to a given coordinate to draw or, in other words, the texel the coordinate is matching.

Linear interpolation between 2 texels means to mix the colors of them using more of the nearest texel and less of the others according to the distance to a certain coordinate.

Nearest interpolation between 2 mipmap levels consist in taking the mipmap whose size fits better the size of the image to draw

But I cannot understand how linear interpolation works with mipmap levels.

**Tags:** opengl, image-processing, image


---

## 2 answers

### Answer by username_3 on 2017-03-02. Score: 4 | Accepted answer

It's called [trilinear interpolation](https://en.wikipedia.org/wiki/Trilinear_interpolation). You first do a bilinear interpolation of the higher-res texture, then do a bilinear interpolation on the lower-res texture, then interpolate between the 2 results. The weight of the final interpolation is based on where between the 2 textures your Z-coordinate falls. If 0 is fully the low-res texture and 1 is fully the high-res texture, then you can use the standard glsl `mix()` function to combine the two:

```
result = (highres texture color * weight) + (lowres texture color * (1.0 - weight));

```

> **Comments:**
> **username_0**: You are talking about GL_LINEAR_MIPMAP_LINEAR filtering method, but if you use GL_NEAREST_MIPMAP_LINEAR instead then you first do a nearest interpolation of the higher-res and lower-res textures, and then mix the resulting colors giving more preference to the nearest mipmap and less preference to the furthest. Am I correct?  
> **username_3**: Actually, for nearest, you would just pick either the high res or low res texture (which ever is nearest), and then within that texture do a normal 2D nearest-neighbor look-up.  
> **username_4**: For GL_NEAREST_MIPMAP_NEAREST we pick the nearest mipmap and applies nearest filtering to that. Since it renders very differently to simply using GL_NEAREST for texture minification I can only assume that GL_NEAREST lazily picks whichever mipmap is "good enough" (maybe you can provide clarification?).  
> **username_4**: With mipmap interpolation we have 2 parameters: mipmap selection and interpolation. For mipmap selection it's decided by GL_xxx_MIPMAP_selection, and for interpolation it's decided by GL_interpolation_MIPMAP_xxx. So in that sense only GL_LINEAR_MIPMAP_LINEAR is truly a trilinear filtering method. (If I understand corrrectly)  

---

### Answer by username_1 on 2017-03-03. Score: 2

You might find the 1983 paper that introduced this\*\*, i.e. [Lance Williams' "Pyramidal Parametrics"](https://classes.soe.ucsc.edu/cmps160/Fall05/papers/p1-williams.pdf) informative.

You can ignore the scheme, in Figure 1, he used for the layout of the MIP maps as I doubt any hardware, at least in the last 20+ years, used that approach.

\*\* *(Actually, Williams \*may\* have described the technique at an earlier SIGGRAPH (1981) as part of tutorial/course but I've never been able to get hold of a copy)*

> **Comments:**
> **username_2**: Fantastic reference. Always fascinating to read original papers which introduced new technologies that we all but take for granted these days.  

---

