FPS dropped significantly after adding Constraints

papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

FPS dropped significantly after adding Constraints

Post by papaonn »

Hi my simulation FPS dropped significantly after adding constraints.

Is there any clue why is constraint eating so much memory?
I suppose it should not drop so much where I have only 50 objects (mostly cube / sphere),
and the constraint is of type btHingeConstraint.

Is there any way to boost up the performance of FPS?


Thank you.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: FPS dropped significantly after adding Constraints

Post by Basroil »

Are you using release build or debug? If it's debug there's a chance it can take more than 15ms to calculate, but release should be good for a bit more (depends on computer and just what those objects are doing). Joining everything with joints can take a toll though.
papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

Re: FPS dropped significantly after adding Constraints

Post by papaonn »

Hi thanks for reply,

Yah it is under release mode,
I didn't vsync up with my pc, so letting it to boost up the maximum performance,
I had even turned on to the best pc performance.

The original scene is taking 150fps (under release mode),
but after adding the 1st constraint (btHingeConstraint),
it significantly dropped to about 110 fps,
subsequently adding few more (probably 5-10+ constraints) eventually dropped to 30+ fps,
to me this doesn't look good because i am still in the middle of development and might add in new features in future.

Any recommendation?

Thank you =)
User avatar
SynapticBytes
Posts: 74
Joined: Thu Feb 10, 2011 8:27 pm

Re: FPS dropped significantly after adding Constraints

Post by SynapticBytes »

Are you only adding one constraint in total, or one constraint per object?

It seems unusual, as I have a sample scene with one of every constraint running, noticeable performance change, but there is only 2 objects per constraint.
papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

Re: FPS dropped significantly after adding Constraints

Post by papaonn »

Adding one constraint per 2 objects (constraints applied to atleast 2 objects) in my case.

Note : My iteration solver is around 100-500 cycles.
c6burns
Posts: 149
Joined: Fri May 24, 2013 6:08 am

Re: FPS dropped significantly after adding Constraints

Post by c6burns »

You are doing 500 iterations in the solver and you are surprised at the FPS drop :shock:
papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

Re: FPS dropped significantly after adding Constraints

Post by papaonn »

Upss sorry, i mean i tested with 100-500 iterations range, all are dropping significantly after first constraint. :lol:
Plus, if i don't set the iterations high enough, the objects are like swinging and fall off from its original pivots, which looks ugly ;'O
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: FPS dropped significantly after adding Constraints

Post by Basroil »

papaonn wrote:Upss sorry, i mean i tested with 100-500 iterations range, all are dropping significantly after first constraint. :lol:
Plus, if i don't set the iterations high enough, the objects are like swinging and fall off from its original pivots, which looks ugly ;'O
Tried the featherstone multi-body or dantzig solver? They help keep iterations low, though dantzig with 50 objects might not give that great of results (speed wise) as it's currently set up.

You can also try just overriding the joint iterations, rather than all constraints. It'll improve speed a bit if you have a lot of contact points.
papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

Re: FPS dropped significantly after adding Constraints

Post by papaonn »

Basroil wrote: Tried the featherstone multi-body or dantzig solver? They help keep iterations low, though dantzig with 50 objects might not give that great of results (speed wise) as it's currently set up.

You can also try just overriding the joint iterations, rather than all constraints. It'll improve speed a bit if you have a lot of contact points.
Hi Basroil, thanks for replying,
By overriding joint iterations meaning?
I can narrow down several stuffs that i don't need in current iteration solver?
Could you explain more in details and examples if you don't mind =)

Thanks !
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: FPS dropped significantly after adding Constraints

Post by Basroil »

papaonn wrote:By overriding joint iterations meaning?
I can narrow down several stuffs that i don't need in current iteration solver?
You can make different joints have different solver iterations, so if joint A is really necessary you can make it 200 iterations, and make everything else the default 10. The best thing is to look at the dynamic control demo (motor demo) and apply this line to TestRig::TestRig in the code where the joint constraint is made.

Code: Select all

hingeC->setOverrideNumSolverIterations(JointIterationCount);



Doing that you can make friction and contact constraints default, but make joint constraints much stiffer (won't droop)