Mipmaps
A collection of texture-images where each subsequent texture is half as large as the previous one. This allows the same texture to be used across multiple objects at different distances (providing a much nicer sampling than using one large texture).
We can specify the texture-filtering for mipmaps as well.
Kind | Meaning |
---|---|
GL_NEAREST_MIPMAP_NEAREST | Nearest mipmap level, with nearest neighbor interpolation. |
GL_LINEAR_MIPMAP_NEAREST | Nearest mipmap level, with linear interpolation. |
GL_NEAREST_MIPMAP_LINEAR |
Kind | Mipmapping | Sampling |
---|---|---|
GL_NEAREST_MIPMAP_NEAREST | Nearest mipmap level to match the pixel size. | Nearest neighbour interpolation. |
GL_LINEAR_MIPMAP_NEAREST | Nearest mipmap level to match the pixel size. | Linear interpolation. |
GL_NEAREST_MIPMAP_LINEAR | Linearly interpolate between the two nearest mipmaps (based on pixel-size). | Nearest neighbour interpolation. |
GL_LINEAR_MIPMAP_LINEAR | Linearly interpolate between the two nearest mipmaps (based on pixel-size). | Linear interpolation. |
Warn: mipmaps can only be used in minification filters. Not on magnification. Eventually when you zoom in enough you'll start seeing pixelation affects and may have to start blurring.
The appropriate mip-map is chosen [see page 31, based] on the distance to the object being rendered (or the projection of the object on the screen). We generally pick two mip-maps based on the rate of change of \((u,v)\) with respect to \((x,y)\) (as we go across the surface of a triangle) and [see page 32, interpolate] between the two closest mip-maps for the final texture value. If the \((u,v)\) values are changing very quickly over a small \((x,y)\) range then the triangle must be very far away (because nearly the entire texture is visible on it).