SlideServe
Menu
Préférences
© SlideServe · v2026

Visibility Queries Using Graphics Hardware

deacon-bean avatar
20 diapositives · 425 Views · Nov 04, 2014

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.

Visibility Queries Using Graphics Hardware - slide 1
01 / 20Visibility Queries Using Graphics Hardware
1 / 17

Télécharger la présentation

Visibility Queries Using Graphics Hardware
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  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