dgSkeletonContainer::m_nodeCount type

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

dgSkeletonContainer::m_nodeCount type

Postby Crashy » Thu Feb 25, 2016 6:47 am

Hi,

Don't ask me why (;) ), but I'm trying to create a skeleton container with up to 200 bones.
The problem is that the m_nodeCount member value type is dgInt8, which allows only 127 bones.

Is there a fundamental reason for this limit, or may I set this count to dgInt32 and add as many bones as my CPU can compute in real time ?

Thanks.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: dgSkeletonContainer::m_nodeCount type

Postby Julio Jerez » Thu Feb 25, 2016 9:24 am

no, no reason at all, I just thought that 256 node was sufficient. for some reason I keep that bone limit is my mine for mu day as a game programmer and GPU has a 256 bone limit.
I will change to be an integer.

what are you doing that nee 200 bones, that's some serious bone skeleton we are talking here? I do not think I ever saw a practical articulated body that complex, but I love it:shock:
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgSkeletonContainer::m_nodeCount type

Postby Crashy » Thu Feb 25, 2016 12:58 pm

Well I've tried it without waiting your answer. :mrgreen:

It seems to work (although a little bit unstable) and it's quite fast, but sometimes crash in buildJacobianMatrix.

I'm trying to simulate a loooong rope, but I think I'll do it differently (simulate only visible part of the rope and fake the offscreen part).

If you want more infos about the crash, I can give you the exact line and a callstack.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: dgSkeletonContainer::m_nodeCount type

Postby Julio Jerez » Thu Feb 25, 2016 4:03 pm

yes please give me the exact line. It should simulate a long rope easy if you allow for some relaxation.

There are tow new function in the custom joint.
Code: Select all
dFloat CustomJoint::GetStiffness () const;
void CustomJoint::SetStiffness (dFloat stiffness);


you can set them to say 0.95f or play with the values. But this is a new functionality that I have no added to all joint I only tried the Hinges.
which Joint are you using? I can add that and comment the change so that you can try and see if it is more stable. Do no forget to tell me the crash line please.

also one of the new feature for 3.15 is Physics particles, and it will be easy to make real cheap Rope, on undefined length that are very cost effective. But that still far away.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: dgSkeletonContainer::m_nodeCount type

Postby Crashy » Fri Feb 26, 2016 4:57 am

Hi,

Here is the callstack
Code: Select all
dgWorldDynamicUpdate::BuildJacobianMatrix(const dgBodyInfo * const bodyInfoArray, const dgJointInfo * const jointInfo, dgJacobianMatrixElement * const matrixRow, float forceImpulseScale) Line 332   C++
dgWorldDynamicUpdate::BuildJacobianMatrix(dgIsland * const island, int threadIndex, float timestep) Line 472   C++
dgWorldDynamicUpdate::CalculateIslandReactionForces(dgIsland * const island, float timestep, int threadID) Line 38   C++
dgWorldDynamicUpdate::CalculateIslandReactionForcesKernel(void * const context, void * const worldContext, int threadID) Line 700   C++
dgThreadHive::dgThreadBee::RunNextJobInQueue(int threadId) Line 100   C++
dgThreadHive::dgThreadBee::Execute(int threadId) Line 73   C++
dgThread::dgThreadSystemCallback(void * threadData) Line 226   C++
ptw32_threadStart(void * vthreadParms) Line 225   C


And the exact line (332):
Code: Select all
const dgVector invMass0(body0->m_invMass[3]);


Problem is that body0 value retrieved from the array is 0xbaadf00dbaadf00d

I'm using CustomBallAndSocketWithFriction as joints, with a friction of 20.0f.
I've also tried to use Hinges and call SetFriction onthem, but sometimes it behaved strangely.

To explain my experiments, I want to simulate a rope, but in 2D, so if there is any way to constraint it on a plane, it would be great. :)
I thought at first that using hinges will help, but after a few interactions with environement, they started to move in "three dimensions".

I'll try to play with the stiffness value, it may help me a lot.

PS: Did I say that Newton is awesome ? :wink:
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: dgSkeletonContainer::m_nodeCount type

Postby JoeJ » Fri Feb 26, 2016 5:48 am

Crashy wrote:To explain my experiments, I want to simulate a rope, but in 2D, so if there is any way to constraint it on a plane, it would be great.


You could create a plane constraint and apply it to each body, its submit callback would look like this:

void CustomPlaneConstraint::SubmitConstraints (dFloat timestep, int threadIndex)
{
dMatrix matrix = NewtonBodyGetMatrix...; // get body COM
dVector planePos (0,0,0);
dVector planeNorm (0,1,0);
NewtonUserJointAddLinearRow (m_joint, matrix.m_posit, planePos, planeNorm);
}

Hope it works, i'm out of practice :)

Edit: Those plane joints should not be part of the skeleton.

Edit2: That's not optimal, maybe you need to constrain orientation as well.
Todo so, you would need to further add an Up Vector constraint aligned with plane normal,
or add this functionality to your plane constraint.

To make it perfect, you could disable 1 row from the ball socket, because it has same function as the up vector. Might improve stability & performance.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: dgSkeletonContainer::m_nodeCount type

Postby Crashy » Mon Feb 29, 2016 3:50 am

Thanks for the info, I'll try to play with that. It's the first time I use constraint, I was afraid I start, but it's not that complicated to setup :)

For information, I disabled CCD for the bodies of the rope, and it's not crashing anymore.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 10 guests

cron