ReadPixel Depth Buffer Precision

toneburst's picture

Hi,

just thought: would it be possible/desirable to use some kind of RGBA packing to get greater precision in the output of the GL Read Pixel Depth Buffer output? I'm imagining this might help with depth-dependent effects like SSAO or depth-of-field shaders.

Or, I could be utterly wrong. Happens quite a lot...

a|x

cwright's picture
Re: ReadPixel Depth Buffer Precision

Possible: yes, but not at any reasonable speed Desirable: depends on the intent (if speed isn't an issue, yes, otherwise, no)

Notes: we're actually reading the depth buffer in floating point precision. The texture is 128bpp, I believe. That's a lot of precision. However, we get to fight through CoreImage color correction, QC color correction, and any clamping/quantization that those two technologies impose without documentation, which is probably the cause of the apparently-limited output... not sure how to work around that :/

toneburst's picture
Re: ReadPixel Depth Buffer Precision

Ah, OK...

I haven't fully investigated, but I assumed for some reason it was 8bt/ch by the time it emerged from the image output of the patch in QC.

Funnily-enough, I was getting unexpected results with the simple CIFilter I wrote to adjust the range of tone in the depthmap texture, so maybe it does have higher precision. Alternatively, I could just have made a mistake in my CIFilter code...

a|x