Find Related products on Amazon

Shop on Amazon

Mipmap selection in too much detail

Published on: 2025-07-08 13:17:14

Mipmap selection in too much detail In this post, I want to shed some light on something I’ve been wondering about for a while: How exactly are mipmap levels selected when sampling textures on the GPU? If you already know what mipmapping is, why we use it, and what pixel derivatives ( ddx() / ddy() ) are, you can skip to the section Derivatives to mipmap levels. The post does, however, assume some knowledge of graphics programming. Mipmapping primer A very common operation in shaders is texture sampling. In HLSL, we typically use the Texture2D.Sample() function for this. For a regular 4-channel floating-point texture, the full function signature looks like this: float4 Texture2D . Sample ( SamplerState sampler , float2 location ); It takes as input a location to sample the texture at, and a SamplerState , which is an object containing metadata used to influence the sampling, like which texture filtering mode should be used. Here is an example of a simple fragment shader which sha ... Read full article.