Depth map - mipmaping

Hi every one!

I try to mipmap a depth texture which is attached to a FBO as a Depth buffer (a texture, not a render buffer).
I’m using the function glGenerateMipmapEXT which works for color texture but not for the depth map… :frowning:

Is it really possible to mipmap a depth map with the glGenerateMipmapEXT function?

Mipmapping for depth textures is pretty useless, don’t you think? Depth textures have no mipmaps.

I totally agree with you.
I just want my FBO class to be complete but now I think I’m going to renounce to this idea…

Just to say that generate a mipmap for a depth map actually works at my home on a geForce7900. I suppose it doesn’t work at my work due to driver problem (need update).

bye!

well it may work but as zengar saiz its useless cause the depthbuffer is nonlinear

eg 2 texel of 0.5 + 1.0 the average is 0.75 but in depthspace this aint the halfway point between the 2 depths

The depth buffer is linear in screen space, so as long as you stay inside a polygon taking the average will give you the correct depth for the halfway point between the samples.

The problem is that the halfway point is pretty much meaningless at polygon edges because it doesn’t correspond to any surface.

While mipmapped depth textures are pretty useless for traditional shadow comparison, mipmap generation is orthogonal to the texture format. The spec doesn’t disallow depth mipmaps, so they have to work.

Of course there’s no requirement to use a depth texture as shadow data. You can use it as just another output (gl_FragData[0…n] + gl_FragDepth) and in this sense it may be perfectly reasonable to generate depth mipmaps.