Jump to content
  • Advertisement
Sign in to follow this  
Geometrian

Selecting Area

This topic is 2949 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,

So, I'm working on a progressive refinement radiosity implementation. Evidently, I need to render a scene and find out what ratio of pixels is filled by a given object.

For example, ideally, given objects 1, 2, and 3 in a scene, if the scene were to be rendered, I'd like to know that:
-object1 would cover 11% of the screen's pixels
-object2 would cover 5% of the screen's pixels
-object3 would cover 0% of the screen's pixels
-therefore, 84% of the pixels would not covered

The obvious solution is to render the scene, read back the pixels, and then count them in software, but this seems inelegant and slow. Is there a better way? Perhaps using the selection or feedback buffers?

Thanks,
G

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Hmmmm, seems the solution is slightly more complicated. I need to be able to test at least 560 different elements, and preferably around a million. glGetQueryivARB(...) is telling me I only have 32 to work with . . .

Second opinions?

Thanks,
G

Share this post


Link to post
Share on other sites
I'm now using glReadPixels and a RGB indexing system (256^3 possible indices). Seems to be working all right, I suppose. No other OpenGL way? Occlusion querying seemed so perfect . . .

Share this post


Link to post
Share on other sites
Quote:
Original post by Geometrian
I need to be able to test at least 560 different elements, and preferably around a million. glGetQueryivARB(...) is telling me I only have 32 to work with . . .
AFAIK, you can issue more than one query at once.

Share this post


Link to post
Share on other sites
In my opinion occlusion queries are not the way to go. The overhead to handle queries and potentielly destroying your renderpipeline by setting up thousands of queries. Then there's the problem of z-buffering. You need to render the scene first to the z-buffer else you will get incorrect results from your queries.

Use PBOs to speed up the read back of the buffer, then use multithreading (each thread get its own "secondary" array to avoid locking, see previous thread ) to utilize multiple cores while rendering the next patch to an secondary framebuffer.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!