PDA

View Full Version : Depth map - mipmaping



hseb
02-26-2008, 08:21 AM
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... :-(

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

Zengar
02-26-2008, 09:07 AM
Mipmapping for depth textures is pretty useless, don't you think? Depth textures have no mipmaps.

hseb
02-26-2008, 09:19 AM
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...

hseb
02-27-2008, 12:59 AM
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!

zed
02-27-2008, 02:40 PM
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

Xmas
02-28-2008, 03:25 AM
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.

arekkusu
02-28-2008, 03:44 AM
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.