Depth Image and "Read-only" depth test

idlefon's picture

I have a bunch of iterators that render a quad in a 3d space. I'd like to use the additive blending along with "read-only" depth test (it looks much better than "read-write" depth test option). I'd also like to get the Depth Image of my environment (via Kineme Read Pixels or RII with Depth Image patch) to simulate a depth of field effect.

My problem here is that the depth image only works when the depth test is set to "read-write" (the uglier look). Is there a way to solve this?

I attached a simple comp that demonstrates my problem.

Cheers!

PreviewAttachmentSize
Simple Depth Bug.qtz5.11 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: Depth Image and "Read-only" depth test

What is it about read-write that you think looks ugly? That's the correct method to use.

Your comp uses a sphere and not a quad, like you say you're having a problem with, so it's hard to suggest a solution.

Are you having a problem with the order you're drawing in being mixed up and looking weird when you do a textured quad? I didn't go too far, but you may want to look at your actual problem qtz with the quad in it, and reverse the z order.

idlefon's picture
Re: Depth Image and "Read-only" depth test

I didn't quite get what you mean by " reversing the z order" . I attached my original comp, and two pics which show the difference. As you can see the "read-write" method makes a "flickering" center.

PreviewAttachmentSize
Read-Only.jpg
Read-Only.jpg95.53 KB
Read-Write.jpg
Read-Write.jpg84.22 KB
6- Iterated in 3D Depth Of Fied.qtz18.81 KB

gtoledo3's picture
Re: Depth Image and "Read-only" depth test

http://en.wikipedia.org/wiki/Z-fighting

You're drawing everything at exactly the same place in Z, so there's no difference in depth with all of the verts/textures you're drawing. If you spread stuff out by some small amount in Z, it will eliminate that, but note that the shade of black/white intensity when reading depth is going to scale with the actual difference in Z. So, if you're drawing everything at the same place in Z, it will all blur the same, and there won't really be much if any apparent depth, or much difference when doing a blur dependent on luminosity.