Hi, all. I'm trying to use Irrlicht for a 3D tiled map type of game. Each tile is composed of 8 triangles ordered around the center, using a single mipmapped texture (I assume mipmapping works, since COpenGLDriver is returning "true" to the mipmap query). The tile node is a simple derivation from ISceneNode, and it does nothing exceptional.
The frame rate is very low compared to what I expect - for a 32x32 tile map (8192 tris) OpenGL frame rate is about 115 with VSync disabled. For 64x64 tiles (32768 tris), frame rate is around 30fps - suggesting that the frame rate is scaling linearly to the number of tris. The only objects in the scene graph are the tiles, a parent node that does not render, and a FPS camera node. D3D9 runs about 10% faster, but it does not look as good. Frame rate also does not appear to improve when I tilt the camera "down" - I would expect culling to eliminate a lot of these meshes.
This is a MinGW Debug build on a fairly quick CPU dual Xeom 3.2GHz, 2G RAM, NVIDIA Quadro4 980 video card (I have had 60+fps on much more complex images, including the Irrlicht examples).
Any suggestions where I should look to find the bottleneck?
Poor frame rate
-
randomMesh
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: Poor frame rate
Hard to say without any code.GnarlyHotep wrote:Any suggestions where I should look to find the bottleneck?
Irrlicht lib has been compiled in release mode?
Re: Poor frame rate
In your case it is more likely linear to the number of individual scene nodes, If I understand you correctly.GnarlyHotep wrote:The frame rate is very low compared to what I expect - for a 32x32 tile map (8192 tris) OpenGL frame rate is about 115 with VSync disabled. For 64x64 tiles (32768 tris), frame rate is around 30fps - suggesting that the frame rate is scaling linearly to the number of tris.
You have a scene node for each tile? Don't do that!
Minimizing the number of scene nodes (and thus drawXXX calls) is crucial for performance. There is a significant constant overhead for rendering an object indifferent of the actual number of triangles/fill-area. It is *much* faster to render a single object with 100,000 triangles than 1000 objects with 100 triangles each.
Instead of putting each tile inside a separate scene node, build a scene node with all tiles, or a bigger number of tiles rather. You probably should create your own subclass of ISceneNode or maybe you can use one of the different Tile scene nodes floating around the forum.
-
GnarlyHotep
- Posts: 10
- Joined: Tue Aug 14, 2007 6:35 pm
First, let me kick myself for complaining about performance in *DEBUG* mode
. I recompiled in release, and I get 72 fps instead of 30. Still slow, but, as you point out, I'm running through 64^2 nodes +/-.
I put them in separate scene nodes for culling purposes - no sense sending all the vertex data to the graphics card if a significant percentage would/could be culled. Although maybe that's not the right strategy, based on your comment.
I'll go back and rethink how best to represent the tiles without hitting the 64k index limit. There's a couple of possibilities that I can think of right away.
I put them in separate scene nodes for culling purposes - no sense sending all the vertex data to the graphics card if a significant percentage would/could be culled. Although maybe that's not the right strategy, based on your comment.
I'll go back and rethink how best to represent the tiles without hitting the 64k index limit. There's a couple of possibilities that I can think of right away.
It really isn't. Culling on this fine level gets you nowhere, because the constant overhead for rendering a distinct object is rather large. Also as you noted in your first post, Irrlicht's view-frustum-culling is done very coarse. In a common scene this is no problem though.GnarlyHotep wrote: I put them in separate scene nodes for culling purposes - no sense sending all the vertex data to the graphics card if a significant percentage would/could be culled. Although maybe that's not the right strategy, based on your comment.
...right.Culling on this fine level gets you nowhere
What I did is that I divided terrain in to blocks of tiles and doing culling test on blocks rather than individual nodes. This makes fairly good compromise between speed and precision. With 25 blocks (5x5) I can exclude about 60%of tiles from rendering.
Also default Irrlicht culling is done by camera frustrum bounding box not frustrum itself. I wrote my own culling test done by frustrum which is around 50% more efective.
Check out my Tilled Terrain Scene Node: http://irrlicht.sourceforge.net/phpBB2/ ... 342cbd62e9
Source code is included, it might be of some help for zour project.