occlusion culling without extension in two passes ?

hi everyone.

wouldn’t it be possible to do something like occlusion culling by rendering the scene with two passes and different state setup, if no extension is available on the target platform ?

How would you read the result back in a useful manner?

Originally posted by jwatte:
How would you read the result back in a useful manner?

The same way we’ve been doing for years: render the scene with color tags (unlit, no alpha, no texture, etc…) and build a histogram. Assign one unique color per visibility group (object, primitive, whatever) and the histogram will count how exactly many pixels of that group are visible in the final image and unlike HW_histogram, do this regardless of draw order.

The big downside of this approach over HW_occlusion is the full buffer read, since HW histogram is almost never supported. But that doesn’t make it “not useful” for some applications.

Avi

@Cyranose:

do you have any links or a similar starting point ?! have you tried this way ?
i mean, is it really useful, or is the overhead so big that it’s useless, in comparison to the hardware method ? i’m interested in such way, because my target platform has no support for ARB_occlusion_query, or at least “it mustn’t have” - so, i thought doing this in software would be a work-around for older graphic cards.

You could do something like you suggest to get some occlusion query info, but it would certainly be expensive.

To behave exactly like OQ, you have to count fragments that overlap each other and still pass the depth test. So back-to-front rendering will produce a lot more “temporarily visible” samples than just reading the final buffer.

Still, if you can get useful information quickly enough by this other method, then it is (by definition) good enough.

Lots of hardware supports OQ now though, so you should probably support it as well since it should be much faster.

Thanks -
Cass