Auto-Sleep despite collisions?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Auto-Sleep despite collisions?

Postby Markus » Sat Mar 19, 2011 6:47 am

Hi,

I was programming a little prototype for a dominoes simulation and encountered some performance issues. I created a row of domino pieces (box shapes) and then knocked down the first one, resulting in the entire set of pieces to fall over. Now, the problem is that the entire set of boxes is colliding, and after some time the FPS sink lower and lower:
Image

After all pieces fell over the FPS rise again, because the bodies begin to sleep. That's obviously not possible before, even for the first one, because it is still in contact with the box just falling over. Is there a way to put the pieces on the ground to sleep, or some other way to improve the performance?

Thanks,
Markus
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: Auto-Sleep despite collisions?

Postby JernejL » Sat Mar 19, 2011 7:52 am

So, what is wrong with that? The bodies go to sleep when they are stationary, not when they are "not colliding with anything". They will be waken up once neccesary automaticly.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Auto-Sleep despite collisions?

Postby Markus » Sat Mar 19, 2011 8:24 am

The problem is that they wont go to sleep although they are stationary. Every box lying on the ground (not moving anymore) is connected through the chain of pieces to at least one box that is currently falling to the ground (still moving). Only when ALL of the pieces are stationary, they begin to sleep.

Image

In this picture, the right side of pieces is sleeping, because it is not connected (through collisions) to a falling box. However, on the left side all pieces (not counting the ones still standing) are active, even the ones lying stationary on the ground, until there is a second gap in the row of boxes, or all boxes have fallen and are stationary.
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: Auto-Sleep despite collisions?

Postby Stucuk » Sat Mar 19, 2011 11:27 am

They are not stationary. They continue to move as the domino infront gets lower.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Auto-Sleep despite collisions?

Postby Julio Jerez » Sat Mar 19, 2011 11:45 am

how many dominos are we talking about?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Auto-Sleep despite collisions?

Postby Markus » Sat Mar 19, 2011 11:58 am

Stucuk wrote:They are not stationary. They continue to move as the domino infront gets lower.

That's correct, but it changes after the fourth or fifth decimal place. Is there a way to set a threshold for that?

Julio wrote:how many dominos are we talking about?

After about 200 boxes the FPS sink rapidly until I have like 1-2 FPS after 250-300 pieces. Depending on the CPU, they start sinking even faster.
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: Auto-Sleep despite collisions?

Postby Julio Jerez » Sat Mar 19, 2011 8:07 pm

200 bodies is no enogjt to bring the fps down not even a little. you should be able to do a lot more.
I asuming you are using newton 2.xx
if you are did you call

// set the default parameters for the newton world
// set the simplified solver mode (faster but less accurate)
NewtonSetSolverModel (m_world, 1);
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Auto-Sleep despite collisions?

Postby Markus » Sun Mar 20, 2011 6:36 am

I do use Newton 2.29, and I did call NewtonSetSolverModel (m_world, 1) and NewtonSetFrictionModel(m_world, 1).
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: Auto-Sleep despite collisions?

Postby Julio Jerez » Sun Mar 20, 2011 9:58 am

but 200 bodies is not enough to slow the CPU to 1 fps, I can over a thousand bodies and still run higher than that.
Image
those scnes are in the 2.32 demos, has you teat those?

this scene shosw 8 tousands balls all active falling in a complex mesh,
http://www.newtondynamics.com/downloads/Netwon300Test.wmv
and still running ove 20 fps at its worse.

a dominos simulation is a very lightweight in teh sence that ther are no too many mutiple pairs.
you should be able to do several tousands (7 or 8 tousand) all at once before the fps drops below 15 fps.

what cpu are you running this?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Auto-Sleep despite collisions?

Postby Markus » Sun Mar 20, 2011 12:26 pm

I tried it on a Lenovo T400 with a Intel P8600 ~2.4 GHz and in a Virtual Machine with 3 cores of a Core i7 920 CPU 2,67 GHz (Hardware Virtualization), the Laptop is a bit slower. I will try it on my "real" machine later, its running Windows and I have to install an IDE.

Maybe one of you can try it yourself, the Linux executable is availabe here: http://rapidshare.com/files/453504303/NewtonTest. You will need GLEW and libSFML1.6 (from http://www.sfml-dev.org/download.php). You can move with WASD, drop dominos while moving forward and pressing the right mouse button. Pressing the left button will shoot a larger box, use this to knock over the first domino.
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: Auto-Sleep despite collisions?

Postby Julio Jerez » Sun Mar 20, 2011 1:04 pm

in any of those machines It should be a lot better, it should be of the order of 4 or 5 hundred fps, maybe 1000 fps with just 200 boxes regarless of how they are configured.

try the stack demos, they run in linux too, some stacks are 200 x 200 which is more of less 200 boxes see if that is slow, if it not, then set the engine like it is in the demos.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Auto-Sleep despite collisions?

Postby Markus » Sun Mar 20, 2011 1:53 pm

I tried it on my i7 920 2.67 GHz computer, it has like 1000fps when all bodies are sleeping and the FPS sink to 1-2 FPS after about 300 pieces (one thread) and 200 FPS with 500 pieces (four threads). However, when I set NewtonSetPlatformArchitecture to 2 or 3, I get like 530 FPS with 500 pieces.

No change with these Settings on the other machines.
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: Auto-Sleep despite collisions?

Postby Julio Jerez » Sun Mar 20, 2011 3:51 pm

Markus wrote: However, when I set NewtonSetPlatformArchitecture to 2 or 3, I get like 530 FPS with 500 pieces.

That is more like it.

NewtonSetPlatformArchitecture 0 is the default in newton and it uses x87 code, however the the differnet is not that big,
if arch 3 gives you 500 fps, then arch 0 should be between 200 and 300 hundred fps. are you sure you are not using a debug build?

anyway if you set two thread solver mode 1, and paltform arch to 3
you should get way over 500 fps with 200 boxes, and around 100 fps with 1000

you may also want to try parallel solver on single island, sometime that runs slower in sdk 2.00 but in 3.00 will be faster and should literally double the preformance.
so you should get arond 4 to 5 tousand dominos but that is for next version.
sdk 2.xx should be around 1 to 2 tousand and still go over 100 fps.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Auto-Sleep despite collisions?

Postby Markus » Mon Mar 21, 2011 8:08 am

I just recompiled it on the same T400 machine under windows and have much more FPS than on Linux. Actually, with 300 pieces the GPU (some Intel onboard chip) is still the bottleneck and the simulation runs smoothly.

Julio Jerez wrote:are you sure you are not using a debug build?

Well, I use the libraries of a recent SDK. Newton.a is about 2.5MB and Newton.so about 1.6MB, are these the release versions? I also downloaded the 2.32 SDK from Google code and executed the makefile, resulting in similar file sizes and FPS. Any suggestions?

Thanks for your help so far.
Markus
 
Posts: 52
Joined: Sat Mar 19, 2011 6:31 am

Re: Auto-Sleep despite collisions?

Postby Julio Jerez » Mon Mar 21, 2011 9:40 am

your result are diffrent form what I see, I get much highet preformance on linux 64 than in window all in teh same system.
and I mean better by a great deal. My system si an 2.4 ghz intel icore7
what is a T400? that sounds like "liquid metal polyalloy, a techonlogy leap over the t800"

if the botterneck is the GPU then teh problem is shifted now, how much of the frame does the physics takes now?

also there are profiler counters in the engine you can determine what part of the engine is the one that is running slower.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron