occlusion culling

Started by
16 comments, last by glaeken 16 years, 5 months ago
Hi, i am back working on on old idea of mine about occlusion culling , i coded a fast zbuffered-concave/convex-polygon-with-holes function ,and i was proceeding with the next step. My biggest concern is about transforming vertices, i am going to do the job twice, opengl renders its own buffer, while in software the code basically do the same. Now i was thinking about this, since i need the normals for the zbuffer,an algorithm might work in this way. I consider the whole world fixed , and i move the observer in the opposite view direction , its just like in the real world the observer rotates and moves, the rest of the world stays fixed, opposing to what normally happens with opengl or directx. Now i think i am going to need a matrix derived from quaternions. Has anyone done the same thing , or is just a stupid idea ? Is there any way to avoid recompunting twice the vertices(sp??) Thanks and sorry for my english.
Advertisement
If your culling is done on CPU, then of course you need to transform the occluders and ocludees on the CPU as well.
But they must be very low-poly, since you don't wanna do only occlusion, right?
There's not much reason to do any culling other than frustum culling.
Quote:Original post by Joshua Klint
There's not much reason to do any culling other than frustum culling.
Not true.

When doing occlusion culling on the CPU don't test with the same geometry you are rendering. Use a very low poly version or better yet use a bounding box or AABB. Using an AABB you can cut the transformations down to two vertices (min and max for AABB).

Quote:Original post by Joshua Klint
There's not much reason to do any culling other than frustum culling.


Very untrue. For every single scene, with high geometric complexity, overdraw and occluded objects there is two things one can do to save GPU computing power for a better picture - transfer it from the distant scene to the front via LOD, or remove it from hidden and not visible part of the scene via occlusion culling.
In the end, it almost always saves GPU cycles that can be spent somewhere else. Even for higher FPS...
It depends on what kind of scene it is. If you are rendering an outdoor scene there is very little you can do that won't be a special trick that only works in small demos that have absolutely no practical use.

I think most of the theory on occlusion is hangons from the Quake BSP days, and it's not really in tune with what modern GPUs can do.

For an indoor scene, a good portal system can make a big difference, but I see beginning programmers who want to draw 10,000 polys on the screen worry about occlusion, and it doesn't make sense unless you are really going to be pushing the GPU. Unless you are saving at least maybe 20,000 polys with occlusion, don't even bother.

For all culling, you should use a sphere test. This is the center of the object, with a radius of the furthest vertex from the center. It is not terribly accurate, but can be made to err on the side of caution. Anything more complicated than that and you will just slow your app down, unless you are running a quad core CPU with a TNT2 GPU.
Quote:Original post by Joshua Klint
It depends on what kind of scene it is. If you are rendering an outdoor scene there is very little you can do that won't be a special trick that only works in small demos that have absolutely no practical use.

Still very untrue. There's been a lot of work done on outdoor occlusion, and there are a lot of practical techniques you can use.

Valve's Source engine uses "occluder frustums" similar to the ones in this article for outdoor scenes.
It might be a special trick, but it definitely has practical use.

Also: Quad-trees/Oct-trees still receive wide-spread use in outdoor visibility culling, and even precomputed-PVS techniques are still being used...
Quote:Original post by Joshua Klint
It depends on what kind of scene it is. If you are rendering an outdoor scene there is very little you can do that won't be a special trick that only works in small demos that have absolutely no practical use.

Incorrect. Although not as effective as in indoor scenes, occlusion culling can still have a huge impact on outdoor scenes. Especially if they're densly populated (bumpy terrain, vegetation, buildings, etc).

Quote:Original post by Joshua Klint
I think most of the theory on occlusion is hangons from the Quake BSP days, and it's not really in tune with what modern GPUs can do.

I think you don't understand what occlusion culling (according to the modern definition) actually is :) It has strictly nothing to do with BSPs and co, and was never used in Quake. You might be confusing it with PVS, which is indeed a little outdated (a least in the way it was done in Quake). But modern occlusion culling is something completely different than BSP/PVS.

Quote:Original post by Joshua Klint
For an indoor scene, a good portal system can make a big difference,

Sure it can, but is restricted to a certain type of geometry. In fact, portal rendering is a special type of occlusion culling. More general forms of OC, such as HOM or hardware OC with conditional rendering, can entirely replace a portal system. They're both more effective than portals can ever be (by definition), and can handle all types of scenes without specific requirements such as imposed by portals.

Quote:Original post by Joshua Klint
but I see beginning programmers who want to draw 10,000 polys on the screen worry about occlusion, and it doesn't make sense unless you are really going to be pushing the GPU. Unless you are saving at least maybe 20,000 polys with occlusion, don't even bother.

That is true, however OC is a vital part of an engine if you increase the poly load over a certain limit, and if you have scenes with high depth complexity. So it is only natural that beginners should learn about it. Especially since hardware support for OC is increasing.

Quote:Original post by Joshua Klint
For all culling, you should use a sphere test.

No, you should not.

Quote:Original post by Joshua Klint
This is the center of the object, with a radius of the furthest vertex from the center. It is not terribly accurate, but can be made to err on the side of caution. Anything more complicated than that and you will just slow your app down, unless you are running a quad core CPU with a TNT2 GPU.

Incorrect again. Do not make assumptions if you clearly do not have the expertise to back it up. Spatial culling is an extremely important part of any modern engine. Culling removing depth complexity (means everything from occlusion culling, over LOD, to distance based procedural simplifications like adaptive displacement mapping) is even more important on todays shader heavy scenes. The quickest geometry is the one you don't render.
All you have done is contradict everything I said. Why don't you lay out a proposal of how you think culling should be handled? Because there are far too many academic opinions on this subject from people who have never actually made anything but a small demo showcasing their idea under extremely controlled conditions.

I have implemented "occluders" as well, but they are only useful in very specific circumstances. Overall I could easily do without them, but I just left them in because I thought they were neat. And yes, the sphere test should be used because you can quickly check to see if it is inside the planes of the occlusion volume, with no transformations required at all.

Outdoor culling is not that important because if you can't render all your geometry fast enough when the player goes up on a hill or something, you're screwed anyways. For static geometry, it is almost always faster to chuck the whole geometry at the GPU, or at least big chunks that can still be frustum-culled.

For dynamic objects, instanced rendering gives you the speed you need. There are not a lot of conditions under which outdoor culling of instanced meshes will provide more frames than it eats up.
I found GPU occlusion culling worked just fine on my outdoor terrain rendering. Yes, even on top of a hill it is still useful, as some sections of terrain will be overlapping each other in the distance(the big mountains/hills blocking the ones behind them). And if you were to leave the ground and fly up into the sky the terrain would be using a lower LOD anyway. Its fast/cheap and reduces vert count considerably, no reason not to use it.

This topic is closed to new replies.

Advertisement