Performance slowdowns with lo poly models? [solved]

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.
Malebolge
Posts: 19
Joined: Sun Aug 31, 2008 8:24 pm

Performance slowdowns with lo poly models? [solved]

Post by Malebolge »

Hi.

I'm having lots of slowdowns when trying to render around 10 meshes of 800 polys, animated, no lights, no other objects. There's also another mesh, which we move using the keyboard, that's around 1600 polys, also animated.
Probable causes for slowdowns? We've tried using no textures, stopping the animations, etcetera, but we can't seem to find a way to optimize it. We use the basic culling that comes with the engine.

This is what we have on our main loop.

Code: Select all

   while(pManager.getDevice()->run()) 
   {  
	  eventReceiver.endEventProcess();

	  camera.set(player.getNode()->getPosition().X + cameraOffset,cNode->getPosition().Y,player.getNode()->getPosition().Z);
	  cNode->setPosition(camera);
	  cNode->setTarget(player.getNode()->getPosition());


      pManager.getVideo()->beginScene(true,true, SColor(255, 100, 101, 140)); 
      pManager.getSceneMngr()->drawAll(); 
      pManager.getGUIEnv()->drawAll(); 
      pManager.getVideo()->endScene(); 

	
	  if(eventReceiver.keyDown(irr::KEY_ESCAPE)) 
		  pManager.getDevice()->closeDevice();

	  if(eventReceiver.keyDown(irr::KEY_KEY_W)) 
		  player.movement(irr::KEY_KEY_W);

	  if(eventReceiver.keyDown(irr::KEY_KEY_S)) 
		  player.movement(irr::KEY_KEY_S);

	  if(eventReceiver.keyDown(irr::KEY_KEY_D)) 
		  player.movement(irr::KEY_KEY_D);

	  if(eventReceiver.keyDown(irr::KEY_KEY_A)) 
		  player.movement(irr::KEY_KEY_A);

	  
	  player.rotate(pManager.getDevice()->getCursorControl()->getRelativePosition());

	 
	  

	  
	  if (pManager.getDevice()->getTimer()->getTime() > lastTick + spawnTime && enemyAmount < maxEnemyAmount) {	
		lastTick = pManager.getDevice()->getTimer()->getTime();
		
			Zombie z(pManager);
			listZombies.push_back(z);
			enemyAmount++;
		
	  }

	 
	  eventReceiver.startEventProcess();
     
   } 
    
Thanks :)
Last edited by Malebolge on Sun Sep 28, 2008 1:59 pm, edited 2 times in total.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Performance slowdowns with lo poly models?

Post by Seven »

Code: Select all

// while the manager exists
while(pManager.getDevice()->run()) 
   {  
	  // let the event handler do it's thing	
	  eventReceiver.endEventProcess();

	  // set the camera to a good place in the world
	  camera.set(player.getNode()->getPosition().X + cameraOffset,cNode->getPosition().Y,player.getNode()->getPosition().Z);
	  cNode->setPosition(camera);
	  cNode->setTarget(player.getNode()->getPosition());
	
  	  // render the scene
      pManager.getVideo()->beginScene(true,true, SColor(255, 100, 101, 140)); 
      pManager.getSceneMngr()->drawAll(); 
      pManager.getGUIEnv()->drawAll(); 
      pManager.getVideo()->endScene(); 

	  // if the event receiver had a escape key down then do this
	  if(eventReceiver.keyDown(irr::KEY_ESCAPE)) 
		  pManager.getDevice()->closeDevice();

	  // if the event receiver had a W key down then do this
	  if(eventReceiver.keyDown(irr::KEY_KEY_W)) 
		  player.movement(irr::KEY_KEY_W);

	  // if the event receiver had a S key down then do this
	  if(eventReceiver.keyDown(irr::KEY_KEY_S)) 
		  player.movement(irr::KEY_KEY_S);

	  // if the event receiver had a D key down then do this
	  if(eventReceiver.keyDown(irr::KEY_KEY_D)) 
		  player.movement(irr::KEY_KEY_D);

	  // if the event receiver had a A key down then do this
	  if(eventReceiver.keyDown(irr::KEY_KEY_A)) 
		  player.movement(irr::KEY_KEY_A);

	  // rotate the player
	  player.rotate(pManager.getDevice()->getCursorControl()->getRelativePosition());

	  // if the time is right and not enough enemies		  
	  if (pManager.getDevice()->getTimer()->getTime() > lastTick + spawnTime && enemyAmount < maxEnemyAmount) 
	  {	
		// remember the time
		lastTick = pManager.getDevice()->getTimer()->getTime();
		
		// create a new zombie
		Zombie z(pManager);
		listZombies.push_back(z);
		enemyAmount++;
		
  }

what is the value of maxEnemyAmount?
how much does the frame rate change when ther eis

1 enemy?
2 enemies?
3 enemies?
etc....

is it linear or does it maintain a good frame rate until the 5th enemy and then drops like a rock?
Malebolge
Posts: 19
Joined: Sun Aug 31, 2008 8:24 pm

Re: Performance slowdowns with lo poly models?

Post by Malebolge »

Seven wrote:what is the value of maxEnemyAmount?
how much does the frame rate change when ther eis

1 enemy?
2 enemies?
3 enemies?
etc....

is it linear or does it maintain a good frame rate until the 5th enemy and then drops like a rock?
It drops at around 7 or 8, then i'd say it drops again when there around 15. With like 5 or 4 it works at like 200 fps.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

the code looks good but of course, I cannot see the enemy code. if it isnt linear though, then it could be the graphics card. Have you tried on another system?
Malebolge
Posts: 19
Joined: Sun Aug 31, 2008 8:24 pm

Post by Malebolge »

Seven wrote:the code looks good but of course, I cannot see the enemy code. if it isnt linear though, then it could be the graphics card. Have you tried on another system?
On other systems, it works a little better but i'm guessing 800 polys is enough for a 64mb video card+1gb RAM to take.

Code: Select all

Zombie::Zombie(CGameCore &pManager) 
{ 
	
	irr::scene::IAnimatedMesh *tMesh = pManager.getSceneMngr()->getMesh("zombie.b3d");
    eNode = pManager.getSceneMngr()->addAnimatedMeshSceneNode(tMesh);
    eNode->setFrameLoop(3,24);
    eNode->setMaterialFlag(video::EMF_LIGHTING, false);
	eNode->setPosition(pManager.getSceneMngr()->getSceneNodeFromName("generator")->getPosition());

	speed = 1.5f;	
} 
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

For skeletal animated meshes, the number of polys is not necessarily the limiting factor, but it's the number of bones. So how's your mesh modelled? Also, how many textures/materials does it have, etc?
Malebolge
Posts: 19
Joined: Sun Aug 31, 2008 8:24 pm

Post by Malebolge »

hybrid wrote:For skeletal animated meshes, the number of polys is not necessarily the limiting factor, but it's the number of bones. So how's your mesh modelled? Also, how many textures/materials does it have, etc?
Removing the finger bones in the feet and hands did improve the framerate a lot. We're working on 3D Max default biped, minus the couple bones we removed. Still, with no lights, no nothing, we think it should run a little better. Textures right now are 1024x1024 but removing them gave us no performance boost so i'm guessing it's not texture related. Thoughts?
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

How many bones are there exactly, and what's the highest depth in the hierarchy of the bones. Those are key factors, so please provide the numbers. And what FPS, or ms, are you getting now just by deleting those bones? Also, what's the maximum number of bones affecting one specific vertex in your model?
TheQuestion = 2B || !2B
The Creator
Posts: 30
Joined: Wed Sep 10, 2008 9:04 pm

Post by The Creator »

Hi, i'm the animator.

I'm using a biped with 22 bones (using 2 bones for the spine, no fingers and only one toe) as the bones for skin modifier. I add the hole biped as bones, and then adjusted the envelopes to modify the same part of the mesh they represent (for example the upperarm modifies the mesh's upperarm) and a little more.

I don't have the slighest idea what the highest depth is, i did not change any weight and the max number of bones affecting one vertex is, at most, 3.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Is it possible to get this mesh (or a similar one) for performance tests?
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Well I still have yet to hear the actual millisecond count, or frames per second that you guys are achieving, but 220 bones on screen plus another 22 for the player controlled character is actually a lot.

At any rate, I still would like to hear what times you guys are achieving, so I will not make any comparisons just yet.

Also, some specifications of the machine that your testing it on would be nice.
TheQuestion = 2B || !2B
Malebolge
Posts: 19
Joined: Sun Aug 31, 2008 8:24 pm

Post by Malebolge »

Halifax wrote:Well I still have yet to hear the actual millisecond count, or frames per second that you guys are achieving, but 220 bones on screen plus another 22 for the player controlled character is actually a lot.

At any rate, I still would like to hear what times you guys are achieving, so I will not make any comparisons just yet.

Also, some specifications of the machine that your testing it on would be nice.
We're trying it on an onboard video card of 64mb, 2gb ram and a 2ghz processor. Low specs PC because we want to try and make it work on those PCs. With that and 22 bones per character, we get around 20 frames per second with 40 characters on screen, sans the player. So you think we should cut down the bone count? I'm afraid animations will look stiff if that were the case...
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Well I'm afraid to say it does appear to be the number of bones, especially with that low-end of a card. I wouldn't say that you should scale back the number of bones, but rather scale back the number of players on the screen at one point.

Also, in comparison, Gears of War only has about 700 bones on the screen at maximum usually. You have 40 * 22 bones = 880 bones on screen at a time.

But anyways, just curious as I could possibly provide better help, what do you need that many characters on screen for? Like, what type of game is it?
TheQuestion = 2B || !2B
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Animations may appear stiff with lower bone counts but you're running on a pretty low-end spec which games companies would have been targeting years ago, resulting in stiff animations back then. If you want, for example, Crysis quality you need to target the same specs as they target!!
Image Image Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Are you using a release (not debug) build of both your app and Irrlicht?

If not, then you're (literally) wasting your time doing any profiling.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply