Generating mipmaps for 3D textures