I'm writing a Minecraft-like game using Ogre engine and I have a problem. I must optimize my game, because when I try draw 10000 blocks, I have 2 FPS... So, I got the idea that blocks display of the plane and to hide the invisible blocks. But I have a problem - how do I know which blocks at a time are visible to the player?
And - if you know of other optimization methods for such a game, write what and how to use them in Ogre.
Answer
Well, Ogre already implements frustum culling (which basically does not draw anything that couldn't be seen from the camera) but I think your problem is a different one.
You should not really be displaying 10000 blocks, what is commonly done (or at least, in the few Ogre3d based minecraft like clones I've seen (of which I am making one too), and in the original ) is creating a mesh (of some NxNxN region of chunks) which has the outer faces of the cubes shown. That is, when you put 2 cubes side by side, the 2 faces touching can't be seen and therefore don't need to be drawn.
These faces should also be drawn in something like this: http://www.ogre3d.org/tikiwiki/tiki-index.php?page=DynamicGrowingBuffers as modern video cards prefer one mesh of 100000 polygons versus 1000 meshes of 100 polygons.
No comments:
Post a Comment