Strange Zbuffer moiree

This is a dump of depth values as generated from the “render scene to a FBO from the light’s point of view” pass of classic shadowmapping

http://www.lalista.org/pay/debug_zbuffer.jpg

What’s going on here in your opinion? Looks like some Z-fight but nothing is rendered twice, why should a mesh z-fight againist itself?

This is to be expected. You interpret a single 24 bit integer (the depth buffer value) color as 8/8/8bit RGB color.

Right, then there must be something wrong in the way the DEPTH_COMPONENT texture is interpreted thereafter when it’s used for the 2nd pass, the shadowing one, because the exact moiree pattern that’s seen in the picture resurfaces as z-fighting!

(http://www.lalista.org/pay/happy_artifacts.avi - 3.2 mb)

Are you talking about the artifacs on the back of the bear? This is a known artifact in conjuction with shadow mapping, I think it is called “shadow acne” and is usually fixed by biasing the shadowmap depth values by a certain amount.

See pg. 36 here (Shadow Mapping - Isidoro, GDC06), and for a better example of this shadow acne, see pg 6. here (Shadow Mapping, King, GPU Jackpot '04).