Lots of bodies in newton, performance<=ROUNDING_ERROR_64

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Lots of bodies in newton, performance<=ROUNDING_ERROR_64

Post by Luben »

Hi, i'm posting here because the newton forums are restricted to non-free email addresses.

I've just about now added 340±10 newton bodies to my scene. They concist of compund collisions that are built of 5±3 collision primitives.

It's a scene where there are a lot of tables, chairs, forks/knifes, plates, books and pencils. In short a school resturant/cafeteria, with most of the stuff lying on tables, or otherwise stacked. A side note is that everything weights 10 and has these material settings:
0.15 ;Softness
0.05 ;Elasticity
0.75 ;Static Friction
0.5 ;Dynamic Friction
I don't really know what settings would be good, those are practically random values.

What framerates would you expect that this scene produces? I'm sitting on a core2duo@2.2 ghz, and i'm having around... 1 fps, sometimes 3.

I haven't worked with many bodies in newton before, so if anyone has any tips i'd greatly appreciate it. I'm thinking of things like changing the freeze threshold depending on fps and active bodies, or using some kind of collision LOD system, if that's possible.

Changing solver and friction modes is no option. If i do, things start to bounce out of control for no apparent reason.

Well, i hope i've made myself clear enough, otherwise i'll explain more =)
If you don't have anything nice to say, don't say anything at all.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Out of curiosity, what's the frame rate like if you don't render the objects?
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Pretty much the same. I've resized all textures to 2x2 in order to load the scene quickly while i'm testing with newton, but even before i did that i had somewhat ok framerates, until i added physics.
If you don't have anything nice to say, don't say anything at all.
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Since most of the scene starts static with object's bounding shapes are slightly intersecting each other newton isnt hibernating any of the objects even if you set a very extreme freeze threshold. Having all your objects so close to each other will make newton do the collsion checks for all of them every frame, hence without the fritcion everything flys every where because of the collsions happening all the time. If i were you i would start the whole scene with no physics then only switch on physics if the object needs to move(the object is approcahed by camera or other objects).
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Without friction? If you'r reffering to the material properties, what could be a good value?
If i only turn the objects on when something interacts with them(ie. starts as frozen bodies) things may look strange and behave like mines; when you tuch them, they'll 'explode' ;P Thanks for the hint though, i'll think more about this.
If you don't have anything nice to say, don't say anything at all.
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

The problem is your scene is ready to explode!(most physics engine use this hack where if two objects intersect each other the bouance in oppsoite directions so they dont look weird, its to do with how the time steps for collsion are too slow compared to the positions calculated by the basic equations of motion) The friction you are adding just glues the scene together. It a problem of object placement rather than anything else.

Place stuff so their BBboxes dont intesect, let gravity pull the forks down etc... that way things wont explode. If you look in games they always spawn objects above ground do prevent this explosion from happening.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

I've been messing around all day trying to do something about it. Even when i freexe objects on creation and activate them when they are interacted with the framerates are way to low. Now the code is messed up and even uglier than before, and the project seems to be beyond all hope of salvation.
At least for now. I'll check again tomorrow and see if i can fix it somehow.
If you don't have anything nice to say, don't say anything at all.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Are you sure objects aren't starting off interpenetrating? Newton will make lots of callbacks which, if you don't resolve at the first callback, will just happen again next frame.
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

How do you mean, resolve at first callback?

I remade my compund collisions. They are now much simpler, the average primitive count for on cc is now around 1.3. I also don't make compund collisions from just one collision anylonger, and that things improved a lot.

I also freeze my objects on creation now. And i won't reposition my nodes, at least not in the .irr, that'd take years.
If you don't have anything nice to say, don't say anything at all.
Post Reply