[10] | 1 | HARDWARE OCCLUSION QUERIES MADE USEFUL
|
---|
| 2 | ======================================
|
---|
| 3 |
|
---|
| 4 | This programn is a demonstration of the Coherent Hierarchical Culling algorithm
|
---|
| 5 | described in the chapter "Hardware Occlusion Queries Made Useful" of the book GPU
|
---|
| 6 | Gems II. Additional information and sample images are available at
|
---|
| 7 |
|
---|
| 8 | http://www.cg.tuwien.ac.at/research/vr/chcull/
|
---|
| 9 |
|
---|
| 10 | Updates to this demo can can be found on the same webpage.
|
---|
| 11 |
|
---|
| 12 | Copyright and Disclaimer:
|
---|
| 13 |
|
---|
| 14 | This code is copyright Vienna University of Technology, 2004.
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | Please feel FREE to COPY and USE the code to include it in your own work,
|
---|
| 18 | provided you include this copyright notice.
|
---|
| 19 | This program is distributed in the hope that it will be useful,
|
---|
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 22 |
|
---|
| 23 | Author of this demo:
|
---|
| 24 |
|
---|
| 25 | Oliver Mattausch (matt@cg.tuwien.ac.at)
|
---|
| 26 |
|
---|
| 27 | Authors of the book chapter:
|
---|
| 28 |
|
---|
| 29 | Michael Wimmer (wimmer@cg.tuwien.ac.at)
|
---|
| 30 | Jiri Bittner (bittner@cg.tuwien.ac.at)
|
---|
| 31 |
|
---|
| 32 | Date: December 18, 2004
|
---|
| 33 |
|
---|
| 34 | ----------
|
---|
| 35 | Input
|
---|
| 36 | ----------
|
---|
| 37 |
|
---|
| 38 | Help for keybord and mouse is available with F1.
|
---|
| 39 |
|
---|
| 40 | You can switch between the different occlusion modes described in the book chapter using the
|
---|
| 41 | SPACE key (view-frustum culling, hierarchical stop and wait, coherent hierarchical culling).
|
---|
| 42 |
|
---|
| 43 | A visualization of the culling algorithm from can be shown by pressing '1' on the keyboard. Note that the
|
---|
| 44 | classification of nodes usually changes in consecutive frames, so that the hierarchy seems to oscillate.
|
---|
| 45 | This is expected, since the classification of previously visible interior nodes is based on the classification
|
---|
| 46 | of their children, which might be more accurate (leading to the interior node to become occluded) than the
|
---|
| 47 | query for the node itself.
|
---|
| 48 |
|
---|
| 49 | ----------
|
---|
| 50 | The scene
|
---|
| 51 | ----------
|
---|
| 52 |
|
---|
| 53 | The scene used in this program consists of basic objects randomly placed in a box. The extent of the box and the
|
---|
| 54 | number and size of objects can be changed (see F1).
|
---|
| 55 |
|
---|
| 56 | The hierarchical structure is a kd-tree with objects intersecting a split plane placed into multiple leaf nodes.
|
---|
| 57 |
|
---|
| 58 | By playing with the parameters and moving around, the user can explore situtations where occlusion culling is extremly
|
---|
| 59 | useful, and where it is not (because the objects are too sparse or there is too much to see from this viewpoint).
|
---|
| 60 |
|
---|
| 61 | The hierarchical coherent culling algorithm is compared to simple view-frustum culling and the hierarchical stop and wait
|
---|
| 62 | algorithm (which also uses hardware occlusion queries, but in a less sophisticated way).
|
---|
| 63 |
|
---|
| 64 | ----------
|
---|
| 65 | Installation
|
---|
| 66 | ----------
|
---|
| 67 |
|
---|
| 68 | A binary for Win32 is included.
|
---|
| 69 |
|
---|
| 70 | The program should compile under Windows and Linux, a CMAKE makefile for multi-platform
|
---|
| 71 | compilation is included (see www.cmake.org for details).
|
---|
| 72 |
|
---|
| 73 | For Linux, you need to have a working GLUT and GLEW installation.
|
---|
| 74 |
|
---|
| 75 | ----------
|
---|
| 76 | Structure
|
---|
| 77 | ----------
|
---|
| 78 |
|
---|
| 79 | This demo is written in C++ and partly C and uses OpenGL.
|
---|
| 80 | It has few external needs like limits.h, stdlib.h, math.h, string.h, stdio.h, or time.h.
|
---|
| 81 | We also make heavy use of stl classes, like priority_queue.
|
---|
| 82 |
|
---|
| 83 | The program expects the GL_ARB_occlusion_query extension.
|
---|
| 84 |
|
---|
| 85 | The program and especially the mathematical routines are not designed for speed or
|
---|
| 86 | efficiency, but for simplicity and clarity.
|
---|
| 87 |
|
---|
| 88 | RenderTraverser.cpp: implements the core algorithm described in the paper
|
---|
| 89 |
|
---|
| 90 | occquery.cpp: contains the OpenGl setup code, glut stuff, and sets up of the scene hierarchy
|
---|
| 91 | HierarchyNode.cpp: contains a kd-tree hierarchy implementation, which can be traversed by the culling algorithm
|
---|
| 92 | Geometry.cpp: represents simple drawable geometry, so that we have something to cull for the algorithm
|
---|
| 93 |
|
---|
| 94 | Timers.cpp: contains exact timer functions in order to accurately measure the frame render time
|
---|
| 95 | stdafx.cpp: source file that includes just the standard includes
|
---|
| 96 | glInterface.h: includes gl, glut and glew headers
|
---|
| 97 | DataTypes.c: defines basic geometric datatypes
|
---|
| 98 | MathStuff.c: declares some handy mathematical routines
|
---|
| 99 | teapot.h: contains the teapot geometry
|
---|
| 100 |
|
---|
| 101 | If you find any problem with the code or have any comments, we would like to hear from you!
|
---|