1 / 20

Visibility Queries Using Graphics Hardware

Visibility Queries Using Graphics Hardware. Presented by Jinzhu Gao. Motivation. Visibility queries is popular used in different applications 70% of total computation time in hierarchical radiosity Graphics hardware provides fast access to the data computed by the graphics hardware.

deacon-bean
Download Presentation

Visibility Queries Using Graphics Hardware

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visibility Queries Using Graphics Hardware Presented by Jinzhu Gao

  2. Motivation • Visibility queries is popular used in different applications • 70% of total computation time in hierarchical radiosity • Graphics hardware provides fast access to the data computed by the graphics hardware

  3. Point-based Visibility Query • Visibility queries with the same starting point and different ending points • For example: • Eye ray-tracing • A point light source illuminating a scene

  4. Visibility Methods • Ray casting • Z-buffer • Using object ID image • HP Extensions • NV Extensions

  5. Using Object ID Image • Basic Idea: • Assign a specific color for each element in the scene • Render all the elements in the scene • The first surface in a given direction is the one with the color of the pixel intersected in this direction

  6. Using Object ID Image • Advantage: • Easy to implement • Extremely fast • Disadvantage: • Have aliasing errors

  7. Using Object ID Image • Aliasing errors • Sampling the scene using a regular grid • Visibility query is at different points than the original samples

  8. Using Object ID Image • Solution: • Querying neighboring pixels • If all correspond to same surface, answer is correct • Otherwise, just use ray-casting or enhance the image resolution

  9. Performance Test results on a Silicon Graphics RealityEngine II

  10. Conclusion • The ID images gives us rapid answers in places where there are no problems • Use ray-casting for small problems that concern few visibility queries • Use a better ID image for larger problems that concern several visibility queries

  11. HP Occlusion Test (1) • Extension Name: HP_occlusion_test • Provides a visibility determination mechanism • After rendering, query if any of the geometry could have or did modify the depth buffer. • False = geometry could not have affected depth buffer • True = it could have or did modify depth buffer

  12. HP Occlusion Test (2) • The object is not visible if the test fails (returns false) • It is visible if the test passes (returns true) • Typical usage: • Render bounding box for target geometry. • If test fails, you can skip the geometry altogether.

  13. HP Occlusion Test – How to Use • (Optional) Disable updates to color/depth buffers glDepthMask(GL_FALSE) glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE) • Enable occlusion test glEnable(GL_OCCLUSION_TEST_HP) • Render (bounding) geometry • Disable occlusion test glDisable(GL_ OCCLUSION_TEST_HP) • Read occlusion test result glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&result)

  14. HP Occlusion Test - Limitations • Returns a simple TRUE or FALSE • Often useful to know how many pixels were rendered • Uses a “stop-and-wait” model for multiple tests • Driver has to stop and wait for result of previous test before beginning next test • Mediocre performance for multiple tests • Eliminates parallelism between CPU and GPU

  15. NV Occlusion Query (1) • Extension name: NV_occlusion_query • Solves problems in HP_occlusion_test • Returns pixel count – the no. of pixels that pass • Provides an interface to issue multiple queries at once before asking for the result of any one • Applications can now overlap the time it takes for the queries to return with other work increasing the parallelism between CPU and GPU

  16. NV Occlusion Query – How to Use (1) • (Optional) Disable Depth/Color Buffers • (Optional) Disable any other irrelevant non-geometric state • Generate occlusion queries • Begin ith occlusion query • Render ith (bounding) geometry • End occlusion query • Do other CPU computation while queries are being made • (Optional) Enable Depth/Color Buffers • (Optional) Re-enable other state • Get pixel count of ith query • If (count > MAX_COUNT) render ith geometry

  17. NV Occlusion Query – How to Use (2) • Generate occlusion queries Gluint queries[N]; GLuint pixelCount; glGenOcclusionQueriesNV(N, queries); • Loop over queries for (i = 0; i < N; i++) { glBeginOcclusionQueryNV(queries[i]); // render bounding box for ith geometry glEndOcclusionQueryNV(); } • Get pixel counts for (i = 0; i < N; i++) { glGetOcclusionQueryuivNV(queries[i], GL_PIXEL_COUNT_NV, &pixelCount); if (pixelCount > MAX_COUNT) // render ith geometry }

  18. Example – Incremental Object-Level Culling • Rendering a bounding box will cost you fill • Need to be more intelligent in how you issue queries! • Good if you use query for object that you were going to render in any case • Skip the occlusion queries for visible objects for the next few frames.

  19. Incremental Object-Level Culling (2) • Render scene from front-to-back • Draw the big occluders first • Issue queries for other objects in the scene • If query returns 0 in first pass, you can skip the object in subsequent passes • If object is occluded, it will get eliminated at worst in the second pass.

  20. Conclusion • Simple to use in applications yet very powerful • Provides pixel count – a very useful quantity • Can be used asynchronously, more parallelism for you and me • Versatile extension that can be used in a wide variety of algorithms/applications

More Related