Well, about a week ago I got pretty froggy and decided that I would give it a shot. So after a little research, and testing, I have implemented a simple hardware-based bounding box occlusion culling. I am getting some pretty good numbers, with this simple demo, but I hope to improve this even more as I will discuss below. Right now, I'm releasing this, and opening up this thread to show the progress. Oh yes, and currently, this is only working for OpenGL, but as I said, I will discuss more later. My plan is to have a fully-functioning, and configurable, occlusion culling system built-in to Irrlicht.
Download
Download Link
Results
The main thing this occlusion culling system is good for right now is culling non-visible objects, and overdraw that isn't frustum culled yet. At any rate here are my results on an ATI Raedon 200M Xpress:
58 FPS with occlusion enabled; 1,1,15 and 14 occluded; 400 polys
17 FPS with occlusion enabled; 1,1,15 and 10 occluded; 400 polys
6 FPS with occlusion enabled; 1,1,15 and 0 occluded; 400 polys
6 FPS with occlusion disabled; 1,1,15 and 0 occluded; 400 polys
Now mind you, I was in the same position (start) with occlusion culling enabled, and disabled. So as you can see there is a increase of about 56 FPS on my crappy card. At any rate here are some screenshots:



Improvements/To-Do/Checklist
- Well first off, I would like to get this ported over to DX9 which shouldn't be a problem, and will be done by the time I fully release this with patches and everything. I don't know about the software renderers, but I could always give it a try just for academic purposes.
- There is one major improvement that will be first on my list to get done, and that will be rendering this to a texture instead. As we all probably know the main thing to deal with is fill-rate limitations. So it would be nice to expose some methods to user so they can manipulate the render texture size based on their needs.
- Well bounding box occlusion is good for simple things, but gets kind of out of hand once you really big object bounding boxes, and the actual object is a bunch of space. So my intention is for a user to be able to specify a bounding mesh of their liking instead. Which means, they could model a mesh, and then model a bounding mesh, and attach that for occlusion culling.
- Improving the occlusion culling piepline wouldn't be to hard, and would probably yield better results once you get into having tons of objects in a scene. Basically you would just issue the queries early in the pipeline, which is definitely do-able, I just didn't try it yet.

- Make a better demo.

Now if anyone else has some improvements they would like to mention, feel free, and I will look into it.
Thanks
Thanks goes to BlindSide, and hybrid too.