Strange framerate fluctation with a specific mesh

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
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Strange framerate fluctation with a specific mesh

Post by Gorbstein »

Hi,

Ran into a bug in my game this week which has had me tearing my hair out.

I enable vsync to keep everything at a steady 60fps. However suddenly my delta time between frames started fluctuating, making the game jerky and unplayable. I started removing parts of my game right to the bare bones where all I had was a standard irrlicht render loop displaying some meshes, and still had the problem.

I tracked it down to a specific mesh file and I don't know why it specifically would cause a problem.

So if I load and display 100 scenenodes with the fighter mesh from Psionic's webpage : http://www.psionic3d.co.uk/?page_id=25 I get big spikes in my deltatime between frames. I logged them like this:

Deltatime 0.017
Deltatime 0.017
Deltatime 0.017
Deltatime 0.017
Deltatime 0.029
Deltatime 0.009
Deltatime 0.009
Deltatime 0.018
Deltatime 0.017
Deltatime 0.017
Deltatime 0.017
Deltatime 0.017
Deltatime 0.017
Deltatime 0.029
Deltatime 0.009
Deltatime 0.01
Deltatime 0.017
Deltatime 0.017
Deltatime 0.017
Deltatime 0.017

The mesh has ~900 tris in 1 group, 1 texture.

If I change one line in my code to replace the mesh filename with another, an asteroid containing 2000 tris, I get a rock steady 60fps.

Deltatime 0.016
Deltatime 0.017
Deltatime 0.017
Deltatime 0.017
Deltatime 0.016
Deltatime 0.016
Deltatime 0.018
Deltatime 0.016
Deltatime 0.018
Deltatime 0.016
Deltatime 0.016
Deltatime 0.018
Deltatime 0.016
Deltatime 0.016
Deltatime 0.017
Deltatime 0.016

Any idea why this would be?

D
Image
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post by Gorbstein »

Hmm even if I use Psionic's Jeep model (2000 tris), I get a solid 60fps. Switch back to his fighter and the juddering is back.

Tried disabling hardware mapping, turned off lighting, converted the .3ds to an .ms3d, changed the texture.. still the same!

Weird!!

D
Image
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

On my ati, when i use vsync, i have 1.6k fps with d3d8, 56 fps with d3d9 and 57 fps with opengl.
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post by Gorbstein »

Its not so much a framerate problem as a consistency problem. It's as if this particular model is causing a stall in the pipeline somewhere every so often.

I can turn vsync off and get avg. 1000FPS, but even then I can still see the stuttering when I use this model.

The reason it's a problem is when I run the game on lower specced machines which run at about 40fps without vsync. Then there's very obvious juddering. Without this model, it still runs at 40ps but it runs smoothly.

Would be useful to know what causes it so I can avoid it.
Image
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

I don't know the reason why this happens. In my apps i just avoid sticking to fps.
CuteAlien
Admin
Posts: 9693
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Maybe output the number of rendered polygons as well to see if those numbers do also fluctuate (with getPrimitiveCountDrawn from the driver). I did run the model on Linux but couldn't reproduce this or see anything special so far.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post by Gorbstein »

Good point about the tri count. It doesn't seem to show anything though, the change in tris is not significant when the pause occurs.

I'm suspecting a driver problem, although I'm sure this happens on my laptop too.. will double check.

Frame 1233:Primitives drawn : 14434, Delta Time : 0.018
Frame 1234:Primitives drawn : 14478, Delta Time : 0.015
Frame 1235:Primitives drawn : 14518, Delta Time : 0.032
Frame 1236:Primitives drawn : 14476, Delta Time : 0.008
Frame 1237:Primitives drawn : 14478, Delta Time : 0.011
Frame 1238:Primitives drawn : 14470, Delta Time : 0.017

Frame 1564:Primitives drawn : 12252, Delta Time : 0.017
Frame 1565:Primitives drawn : 12258, Delta Time : 0.016
Frame 1566:Primitives drawn : 12260, Delta Time : 0.017
Frame 1567:Primitives drawn : 12546, Delta Time : 0.018
Frame 1568:Primitives drawn : 12568, Delta Time : 0.016
Frame 1569:Primitives drawn : 12508, Delta Time : 0.07
Frame 1570:Primitives drawn : 12508, Delta Time : 0.012
Frame 1571:Primitives drawn : 12538, Delta Time : 0.013
Frame 1572:Primitives drawn : 12516, Delta Time : 0.011
Image
Post Reply