0
\$\begingroup\$

I am taking a 3D game programming course and my professor provided the class with already-implemented graphics code with OpenGL. The graphics uses frustum culling to remove primitives outside the view of the camera. I did some stress testing by spawning 1000s of boxes and when all boxes are in the view of camera, the FPS drops significantly (from 60FPS to 10FPS).

I have several questions about graphics clipping:

  • Is Frustum Culling (FC) always implemented in every graphics engine?
  • I've read about Occlusion Culling (OC), where objects occluded behind other objects aren't rendered. Does this replace FC or are they used together?
  • Is OC more difficult to implement and therefore FC is the default clipping technique? I'm assuming implementing OC would increase the performance of my "game" since not all 1000s boxes would be rendered.

Any information is appreciated. Thanks!

\$\endgroup\$
2
\$\begingroup\$

In short yes. Both can be used. FC deals only what can be removed outside the camera view. What's inside the view or to be occluded is a more difficult proposition. There are few techniques for occlusion and i don't go into too much detail but you will find a couple of simple methods may improve your performance.

Dynamic occlusion, that is within each frame is challenging performance wise. Unless the objects you are testing are geometrically or complex shader wise you won't see as much of a benefit using some of the more advanced shader techniques. What you can do though to improve performance through occlusion is to get the hardware to work for you.

What i mean is to order your objects in your visible set from front to back. What this gives you is the ability to remove over draw by leveraging the z buffer. The z buffer itself in modern hardware is very fast. This effectively eliminates unnecessary draw actions to your back buffer. And in some cases it's faster as occlusion has edge cases where you end drawing the whole object even if only 1 pixel is exposed.

For static scenes, where criticality of frame time is not an issue, you can get into possible viewable sets (PVS) and this can test whether parts of your static scene can be seen from other parts. This where you can leverage bsp or quad yes to break your world up then test parts against other parts.

It's just a start. There are a number of books on the market talking about occlusion and how to achieve it. Gl

Edit: just to add. No, specifically implemented occlusion may not be in every graphics engine but some form most likely used and in some of the more defunct gpus designs such as tile renderer based would have a form of occlussion built in. To also dd. Using FC before OC makes the process of occlusion faster by only testing to the PVS possible viewable set.

Link to powervr which has an engineer talking about powervr vs radeon and nvidia https://www.imgtec.com/blog/a-look-at-the-powervr-graphics-architecture-tile-based-rendering/

\$\endgroup\$
  • \$\begingroup\$ Thanks for the detailed response! You mentioned Dynamic Occlusion and Z-Buffering; are these the same thing? Or is Z-Buffering a potential implementation to achieve Dynamic Occlusion? I've been reading several resources online and most are using various terms that seem to mean the same thing. It's slightly confusing trying to differentiate between all the different terms. \$\endgroup\$ – AdamInTheOculus Jan 16 at 23:33
  • \$\begingroup\$ The act of sorting your objects from front to back is more the occlusion action. The sorting is leveraging the natural action of the z buffer test operation. What makes it more important is to allow early rejection of the pixel. If you read that link, the author talks alot about avoiding drawing the pixel at all. For example in hlsl shader language you can set early z test. That z test is very effective if your objects are ordered. Understanding how to leverage not only software solutions but also what the hardware can do in conjunction opens up alot of different occlusion techniques. \$\endgroup\$ – ErnieDingo Jan 17 at 20:10
  • \$\begingroup\$ Apologies if my grammar is a bit messy, typing on a phone on a train ain't fun! \$\endgroup\$ – ErnieDingo Jan 17 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.