简体   繁体   中英

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?

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.

二进制空间分区或其表亲四叉树

我只想补充一点,现在一天门户网站通常比BSP更受欢迎,但我没有足够的声誉来编辑原始帖子。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM