A lot of objects - a lot of Slowdown?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Lupinius
Posts: 11
Joined: Thu Apr 30, 2009 8:50 pm
Location: Emden, Germany

A lot of objects - a lot of Slowdown?

Post 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.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post 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).
Lupinius
Posts: 11
Joined: Thu Apr 30, 2009 8:50 pm
Location: Emden, Germany

Post 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?
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

Mesh buffers have an append() function which can be used to combine them.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post 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
Image
Image
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post 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.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Here's a batching mesh scene node from bitplane: http://files.bitplane.net/CBatchingMesh.zip
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post 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.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

It combines the meshbuffers based on their materials
Frank Dodd
Posts: 208
Joined: Sun Apr 02, 2006 9:20 pm

Post 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.
Post Reply