[−][src]Trait web_glitz::image::sampler::MinificationFilter
Sealed trait implemented for marker types that identify minification filtering operations used by Samplers.
Minification filtering is used when a sampling a texture value for a fragment that is larger than the candidate texels.
Minification Filtering and Mipmapping
Some of the filtering methods involve mipmapping. When a fragment is larger than the candidate texels, the fragment surface might span multiple texels. The most appropriate sample value might then be obtained by interpolating between these texels. However, doing this for each sampling operation can be very expensive.
This is instead solved by using a mipmap, which produces similar results with much better performance. A mipmap is a pre-calculated sequence of images, starting with the original image. Each subsequent image is half the width and half the height of the previous image (rounded down). The sequence ends when the width or height reaches 1. Each image in the mipmap sequence is identified by a mipmap level: the base image has a mipmap level of 0, the subsequent image has a mipmap level of 1, etc. For example, a mipmap of a base image of size 256 by 256 has 9 mipmap levels: 256x256 (level 0), 128x128 (level 1), 64x64 (level 2), 32x32 (level 3), 16x16 (level 4), 8x8 (level 5), 4x4 (level 6), 2x2 (level 7), 1x1 (level 8).
See the documentation for NearestMipmapNearest, NearestMipmapLinear, LinearMipmapNearest and LinearMipmapLinear for details on how these filtering operations will make use of a mipmap. See Nearest and Linear for details on filtering operations that don't use a mipmap.