Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualJTippetts

Posted 16 January 2013 - 08:47 AM

Mip-maps were designed at least partially for performance reasons. When a texture is filtered, pixels are sampled from an entire region of the texture. How large this region is depends upon the fragment. Say you have a quad mapped with a texture. If the quad is drawn very near the camera such that there is a 1:1 relationship between screen pixels and quad texels, then for each pixel that is drawn, one texel is sampled. Now if the same quad is drawn far from the camera so that it appears the size of one pixel on screen, then when it is drawn, each pixel samples and filters every texel in the texture. For large textures, this can be a seriously expensive pixel. Add many objects like that in the background, and you can lose framerate in a hurry.

Mip-mapping reduces the resolution so that when this quad is drawn far away, instead of sampling from the top-level mip map, it samples from a vastly reduced resolution version appropriate for the on-screen pixel size of the object. A pre-filtered version, you could say. It is conceivable that if you build mipmaps to a sufficient depth that the mipmap that is sampled in this case will be 1x1 pixels, so that the single pixel of that distant quad only samples a single texel, rather than 1024x1024 texels (or however large the original texture may be). By anybody's reckoning, sampling a single texel is going to be much faster than sampling and blending 1024x1024 texels.

Edit: Ninjaed by Brother Bob. biggrin.png

#1JTippetts

Posted 16 January 2013 - 08:46 AM

Mip-maps were designed at least partially for performance reasons. When a texture is filtered, pixels are sampled from an entire region of the texture. How large this region is depends upon the fragment. Say you have a quad mapped with a texture. If the quad is drawn very near the camera such that there is a 1:1 relationship between screen pixels and quad texels, then for each pixel that is drawn, one texel is sampled. Now if the same quad is drawn far from the camera so that it appears the size of one pixel on screen, then when it is drawn, each pixel samples and filters every texel in the texture. For large textures, this can be a seriously expensive pixel. Add many objects like that in the background, and you can lose framerate in a hurry.

Mip-mapping reduces the resolution so that when this quad is drawn far away, instead of sampling from the top-level mip map, it samples from a vastly reduced resolution version appropriate for the on-screen pixel size of the object. A pre-filtered version, you could say. It is conceivable that if you build mipmaps to a sufficient depth that the mipmap that is sampled in this case will be 1x1 pixels, so that the single pixel of that distant quad only samples a single texel, rather than 1024x1024 texels (or however large the original texture may be). By anybody's reckoning, sampling a single texel is going to be much faster than sampling and blending 1024x1024 texels.

PARTNERS