Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimize Frustum Culling

i am writing a game in C++ and have a level consisting of many seperate meshes, each with their own vertex buffer. i am using vmmlib ( brilliant free gl compat. vector/matrix library ) to create my frustum culler and testing it against the bounding sphere of every mesh in the level. sadly my level can consist of up to 800 meshes and iterating through all of them each frame is slow. what is the best way of optimizing the code so that i don't have to look at all of the meshes on every iteration? Bounding volumes inside the frustum?

like image 617
DavidG Avatar asked Aug 15 '26 09:08

DavidG


2 Answers

Yes bounding object is the way to go, you should take care in choosing an adequate bounding volume, for example for meshes that move about the scene like bots and dont lie down a cylinder is the best volume, other are better represented by cubes (axis aligned or not).

Then you create a quadtree or octree to hierarchically divide the mesh data.

This works very well for outdoor frustrum culling.

For indoors a BSP is the best way to go since you have lots of walls to partition your space. You should still volume bound your meshes that have more than 10 polygons.

like image 91
Caerbanog Avatar answered Aug 16 '26 23:08

Caerbanog


Binary space partitioning or its cousin Quadtree.

like image 26
Eugene Yokota Avatar answered Aug 16 '26 22:08

Eugene Yokota



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!