Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

_nomad_

HP occlusion test question

This topic is 5137 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, according to: http://oss.sgi.com/projects/ogl-sample/registry/HP/occlusion_test.txt it says:
    - disable updates to color and depth buffer (optional)
        glDepthMask(GL_FALSE)
        glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE)
    - enable occlusion test
        glEnable(GL_OCCLUSION_TEST_HP)
    - render bounding geometry
        gl rendering calls
    - disable occlusion test
        glDisable(GL_OCCLUSION_TEST_HP)
    - enable updates to color and depth buffer
        glDepthMask(GL_TRUE)
        glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE)
    - read occlusion test result
        glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result)
    - if (result) render internal geometry
      else don''t render
if a model is partially behind another model, say a person model''s hand is behind a monster model''s body, will the whole person model be occluded (ie, will the ''result'' variable return true or false)? thanks.

Share this post


Link to post
Share on other sites
Advertisement
I''ve never used the HP version but according to the ARB_occlusion_test documentation:

"The earlier HP_occlusion_test extension defined a similar mechanism,
but it had two major shortcomings.

- It returned the result as a simple GL_TRUE/GL_FALSE result, when in
fact it is often useful to know exactly how many samples were
drawn."


so from this, i guess you can only query true or false using the HP test. i''d assume that the HP version would fail when there is even a bit of occusion and only pass if there is no occulsion at all.

Share this post


Link to post
Share on other sites
quote:
so from this, i guess you can only query true or false using the HP test. i'd assume that the HP version would fail when there is even a bit of occusion and only pass if there is no occulsion at all.

No. The occlusion test returns true if any of the samples in a given query pass the depth test. Generally that's all you need BTW.

To the OP: Good luck getting any performance increase with that extension. Even with the ARB extension, I had trouble getting any significant increase in performance with my card. In the end I had to roll my own software occlusion map renderer to do the job.

[edited by - benjamin bunny on May 28, 2004 11:34:43 PM]

Share this post


Link to post
Share on other sites
I think you can get some performance if you CACHE the results. For example, if the camera doesn''t change, you can cache the results for the static objects (of course, some tricks might be necesary).

Share this post


Link to post
Share on other sites
@benjamin bunny - hmm...i''d think that the hardware extension would make everything faster...how''d you go about creating your own software occlusion map renderer? any links to good tutorials?

thanks!

Share this post


Link to post
Share on other sites
Like I said, with my render code, HW OM was significantly slower than brute force for most scenes. Admittedly I didn''t attempt to optimise it much, but I was sufficiently disgusted with the performance that I decided to write my own solution. The result was much better.

The SW occlusion map renderer is basically a Z-buffer software renderer without a colour buffer, that follows the OpenGL spec to project the vertices. The occlusion querying part works in pretty much the same way as the HP extension.

There aren''t likely to be any tutorials on making a software renderer, because it''s a fairly complex process, and you wouldn''t bother doing it unless you understood the theory first. But if you''re interested then you should get a decent book, such as Computer Graphics Principals and Practice in C (2nd ed), and look up 3D clipping algorithms, polygon filling (scanline) algorithms and projection transformations.

Share this post


Link to post
Share on other sites
Or just hack Mesa into your program
benjamin bunny, when you tested the occlusion test HP extension (or the ARB), did you render your actual object, full texture, or only a colored bounding box?

Share this post


Link to post
Share on other sites
quote:
Original post by Raduprv
Or just hack Mesa into your program
benjamin bunny, when you tested the occlusion test HP extension (or the ARB), did you render your actual object, full texture, or only a colored bounding box?


Obviously I used a bounding box for the occludees in order to perform the query. There wouldn't be much point in rendering the full geometry, would there?

[edited by - benjamin bunny on May 30, 2004 1:59:51 AM]

Share this post


Link to post
Share on other sites
hmmm, i''ve been wondering about this, its all very well doing the FFP in software, but what if you wanted to use a VP to perform the translations for the bounding box? I''m guessing you''d enter the fun works of writing your own emulator in software for VP, so do you bother with that or is it something you dont have to worry about for other reasons?

Share this post


Link to post
Share on other sites
quote:
Original post by benjamin bunny
quote:
Original post by Raduprv
Or just hack Mesa into your program
benjamin bunny, when you tested the occlusion test HP extension (or the ARB), did you render your actual object, full texture, or only a colored bounding box?


Obviously I used a bounding box for the occludees in order to perform the query. There wouldn''t be much point in rendering the full geometry, would there?



Well, some objects can be really small, but have a BIG bounding box. In that case, you can get false hits (ie. an object that is otherwise very visible will fail the test).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!