DEV Community
Follow
Unity Mipmaps Beyond Smaller Textures: Temporal Stability, Streaming, and Semantic Mips
Mipmaps are more than just smaller copies of textures; they are crucial for temporal image stability, bandwidth allocation, and preserving meaning across different levels of detail. A texture’s mip level selection is driven by the screen-space density of its projected footprint, not solely by distance. Bilinear filtering blends texels within a single mip, while trilinear filtering interpolates between two adjacent mips. Anisotropic filtering addresses elongated footprints on oblique surfaces, a problem trilinear filtering doesn't solve. The ideal mip sample level can differ from the highest resolution mip actually available in GPU memory, explaining post-cut sudden blurriness. A full mip chain adds approximately 33% more texel data than mip 0 alone, with mip 0 constituting about 75% of the total. Disabling mipmaps might enhance a single screenshot but causes animation instability, moiré, and flashing highlights. Texture import settings should be based on shader expectations, with sRGB being a critical semantic consideration. Alpha-tested shaders can cause foliage to disappear in lower mip levels due to averaging, which Unity's Preserve Coverage can mitigate. Normal map averaging discards variance, leading to unstable specular highlights; this requires careful handling of roughness and potential geometric specular anti-aliasing. Packed mask textures share mip policies, but different data types within them may require distinct filtering or generation approaches. Atlas bleeding worsens at lower mip levels because effective padding diminishes, necessitating designs for the lowest expected mip. Mipmap Limits and Streaming act as quality schedulers, prioritizing textures and managing resident levels based on visual importance. Visualizing approximate mip levels can diagnose issues like UV density discontinuities and atlas bleeding.