Page 1 of 1
A lot of objects - a lot of Slowdown?
Posted: Thu Jul 15, 2010 7:03 pm
by Lupinius
In a game I'm working on a lot of objects are loaded (around 15000). They all just have 2 polygons, but the game is really slow on my machine (0.5 FPS). I'm assuming this is because I'm using the default scenenodes. Can I make the game faster somehow? Would writing a custom scenenode help?
And before anybody asks, the drawing part is slowing the game down, not the game logic.
Posted: Thu Jul 15, 2010 7:42 pm
by slavik262
It's important to combine drawing into as few draw calls as possible. Since each scene node has at least one draw call, lots and lots of draw calls (regardless of how simple) slow down the system. Combine your objects into a single (or as few as possible) mesh(es).
Posted: Thu Jul 15, 2010 8:08 pm
by Lupinius
The problem is that the scene layout is generated dynamically so I'd have to generate the mesh dynamically too. Sadly, I have no idea how to do this, are there any tutorials on that topic?
Posted: Thu Jul 15, 2010 8:09 pm
by slavik262
Mesh buffers have an append() function which can be used to combine them.
Posted: Thu Jul 15, 2010 8:33 pm
by B@z
khm khm...
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=39154 ..khmkhm
everybody tells us to batch the meshes, but noone tells how.
And when i ask, everyone keep quiet..
actually append didnt work for me (dunno why).
So if u can achieve something, please share with me too :3
Posted: Thu Jul 15, 2010 9:24 pm
by slavik262
There's no specific way to "do batching." Batching is just a term that refers to reducing the number of draw calls you make every frame. I don't know why the transform isn't working and I'm not at my home computer right now so I can't check why. There's many ways to create larger batches:
- Use a texture atlas so that you only have to call SetMaterial (a batch breaker) once for multiple draw calls (this would require a custom scene node).
- Use a vertex shader to transform groups of meshes instead of using setTransform (again, this would require a custom scene node).
- Combine mesh buffers (I don't know why append isn't doing what you want - check the source code and figure out what it actually does) and put resulting mesh in a mesh scene node.
Posted: Fri Jul 16, 2010 4:36 pm
by Lonesome Ducky
Here's a batching mesh scene node from bitplane:
http://files.bitplane.net/CBatchingMesh.zip
Posted: Fri Jul 16, 2010 6:14 pm
by slavik262
As questioned in a previous thread, does the batching mesh scene node actually combine the mesh buffers? People who have tested it have said that performance can actually decrease using it, which should be impossible if done correctly.
Posted: Fri Jul 16, 2010 11:54 pm
by Lonesome Ducky
It combines the meshbuffers based on their materials
Posted: Sat Jul 17, 2010 6:25 am
by Frank Dodd
I have posted a reply to baz on batching meshes in
http://irrlicht.sourceforge.net/phpBB2/ ... 331#228331
The example I use for batching meshes batches 2500 object containing a total of about 330,000 polygons without batching and without hardware buffers it runs at 24fps. with batching and without hardware buffers it runs at 66fps.
When I switch hardware buffers on that jumps to 660fps.