View Full Version : Custom Depth Test Problem?

06-04-2013, 08:17 PM
Background: When most of my scene is rendered, I also write the eye space z values to a 32 bit linear depth texture. Next, I render sprites with points, but I use the geometry shader to sample the middle of the sprite. If it passes the depth test, then the geometry shader creates and emits a quad. If the depth test passes, then the whole sprite gets drawn.

The sprites flicker on and off when the eyepoint moves slightly causing the sprite center to move behind the edge of a polygon. Has anyone else run into a problem like this? My best guess is a problem with what I'm writing to the depth texture or imprecision in the depth texture resolution. It's a 1024x1024 4x multisampled texture. I've tried all sorts of things (sampling from 3x3 pixel neighborhoods, weighting samples, discarding samples that are too far) but I can't eliminate the flashing.

thanks in advance.