<p>Let's say I have a cube map that has a resolution of 256x256 for each face and I want to generate mip maps for it using a box filter.</p>

<p>It's tempting to just mip each face individually, cutting the resolution of each face in half for each mip, by averaging each 2x2 group of pixels.</p>

<p>Doing this, information never crosses the boundary of a cube map face though, which feels like it might be incorrect.</p>

<p>What is the correct way to generate mips for a cube map?</p>

CC BY-SA 4.0
2018-09-05T13:48:28.250Z
But then again, when using a box filter anyway, information never crosses the boundaries of a 2x2 block either, or 4x4, or 8x8,... That is to say, the same question stands when mipmapping a regular 2D texture applied in a repeating wraparound fashion, too.
Christian Rau
CC BY-SA 4.0
2018-09-05T14:21:56.270Z
Given that box filters have a poor frequency response, how often are they used in production of MIP maps?
Simon F
CC BY-SA 4.0
2018-09-05T14:58:32.440Z
I'ts pretty common in my experience that engines will have box filter as the default way to make mips for a texture, with other options available such as kaiser windowed sync, for times when that is more appropriate.
Alan Wolfe
CC BY-SA 4.0
2018-09-05T15:12:47.113Z
Fine way for me is using ggx importance sampling with varying roughness in 0 - 1 range, which depends on mip level. Then each iteration stores results in adequate mip level.
mdkdy
CC BY-SA 4.0
2018-09-05T15:18:40.693Z
For the record, this has nothing to do with PBR, just regular old cube map mip maps.
Alan Wolfe
CC BY-SA 4.0
2018-09-05T15:23:18.347Z
Well then we have just good old `glGenerateMipmap` with `glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS)`  :)
mdkdy
<texture><mipmap>
Generating Mip Maps For A Cube Map
Alan Wolfe
# Generating Mip Maps For A Cube Map

(Asked by: username_0 on 2018-09-05)

Let's say I have a cube map that has a resolution of 256x256 for each face and I want to generate mip maps for it using a box filter.

It's tempting to just mip each face individually, cutting the resolution of each face in half for each mip, by averaging each 2x2 group of pixels.

Doing this, information never crosses the boundary of a cube map face though, which feels like it might be incorrect.

What is the correct way to generate mips for a cube map?

**Tags:** texture, mipmap

> **Comments:**
> **username_1**: But then again, when using a box filter anyway, information never crosses the boundaries of a 2x2 block either, or 4x4, or 8x8,... That is to say, the same question stands when mipmapping a regular 2D texture applied in a repeating wraparound fashion, too.  
> **username_2**: Given that box filters have a poor frequency response, how often are they used in production of MIP maps?  
> **username_0**: I'ts pretty common in my experience that engines will have box filter as the default way to make mips for a texture, with other options available such as kaiser windowed sync, for times when that is more appropriate.  
> **username_3**: Fine way for me is using ggx importance sampling with varying roughness in 0 - 1 range, which depends on mip level. Then each iteration stores results in adequate mip level.  
> **username_0**: For the record, this has nothing to do with PBR, just regular old cube map mip maps.  
> **username_3**: Well then we have just good old `glGenerateMipmap` with `glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS)`  :)  

---

## 0 answers

