I just tried to use NVIDIA’s Occlusion Queries in my application for the first time.
I get results and the Nvidia test application works fine but the results in my application isnt 100%.
It reports that almost all of my primitives shows at least 1-3 pixels when they are hidden (just put a big “cube” surrounding everything). This is very strange!
Is there anything I need to set to get better results? The test application is using just a sphere and a box but my scene is a lot more complex so its hard to compare to two!
All feedback is welcome!!!
I’ve used Nvidia’s occlusion queries a number of times in several applications and test cases. The results were accurate to the pixel on a Geforce FX5600 under linux.
Maybe there’s something wrong with the depth test or the order in which the primitives are drawn.
As you most likely know, the results of the queries do not correspond to the pixels that are drawn in the end result, but to the number of pixels that passed at the moment the primitives are drawn.
Did some more in-depth tests with the application and I found out that the tessalation of my geometry is one of the “bugs”.
At certain places were some faces are not 100% in plane with each other faces beneath will show up in a pixel or two. This is a problem but it can most likely be very easly solved by adding a tolerance level.
Another funny thing is that OpenGL reports 2 visible pixels but when I scan the framebuffer I only have one, why is that? is GL_PIXEL_COUNT_NV always (+1)?
Thanks for the answer!
The specification states that, if multisampling is turned on, the result equals the number of samples rather than the number of pixels. So If you have multisampling set to 2x, this might explain the result.
thanks for all feedback …
really useful and is helping me a lot …
will try this multisampling thing, I also found that sometimes the query returns 5 and when I scan the buffer I cannot find any pixels at all … is this possible at all?
will continue playing with this extension …
Can you explain to me what you mean by scanning your framebuffer?
Do you test on written colorvalues or depths?
just doing a colorvalue scan, using ReadPixels. Is this the wrong way fo doing it? And how do I know if GL_PIXEL_COUNT_NV return the right values? I always get 0 from GL_PIXEL_COUNT_AVAILABLE_NV when I example values returned from each of the primitives.
Is that right?
Thanks again for all help!
Can you post the part of your code where you draw the primitives and also the part where you define and initialize the occlusion queries? that could be helpful