Ageia Node Jitter

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Ageia Node Jitter

Post by Slaine »

Hi has anyone fixed the Camera Jitter when you attach a camera to a Node with PhysX applied? I think the Ogre engine fixed it with a type of Interpolation. It Jitters quite badly and I don't know of a fix.

Thanks.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

It's probably down to how you're doing the updates to the node and to the camera... Maybe calling physxNode->updateAbsolutePosition() after setting its transformation to match the Physx Actor would help....
Image Image Image
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Post by Slaine »

Tried it, still jitters, I've taken the physics code out and the jitter disappears, I've even tried custom camera classes which people have written on here, none fix it, it basically gets worse the faster the node moves.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

without seeing the relevant code i don't think anyone will be able to help you out so if you could post a minimal, compilable example which we can check out then we might be able to advise you.
Image Image Image
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Post by Slaine »

But this will happen on the simplist of setups, just attach a camera node to a Node which is under the influence of PhysX and the camera will Jitter, just try it on any of your projects, it's not specific to my code you see.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Well in my Physx wrapper that i'm currently writing it works fine...

That's with just setting the camera's parent to the mesh scene node which is being updated based on the position and rotation of a physx actor. maybe the jittering is caused by something you're doing with the camera target...
Image Image Image
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Post by Slaine »

Hmm, I'll get back to you on that one then :? Are you sure your not doing anything special?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I'm fairly sure i'm not... but you might be doing something different to me... How does your scene node get updated with the Physx information? Is it a special scene node type which integrates with Physx or is it a standard irrlicht scene node which has its position and rotation updated via setPosition() and setRotation()?
Image Image Image
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Post by Slaine »

I'm just using the code either from the SDK or the integration example on here:

Code: Select all

//get wheel actor global position
	NxMat34 pose = actor->getGlobalPose();

	//get wheel actor position
	const NxVec3 pos = pose.t;

	//get wheel actor orientation
	const NxMat33 orient = pose.M;

	//our base matrix
	irr::core::matrix4 irrMat;

	//get orientation to our base matrix
	orient.getColumnMajorStride4(&irrMat.pointer()[0]);

	//get position
	pos.get(&irrMat.pointer()[12]);

	//clear our matrix
	irrMat.pointer()[3] = irrMat.pointer()[7] = irrMat.pointer()[11] = 0.0f;
	irrMat.pointer()[15] = 1.0f;
		
	//set position/rotation to wheel
	_node->setPosition(irrMat.getTranslation());
	_node->setRotation(irrMat.getRotationDegrees());
	_node->updateAbsolutePosition();

JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Well i've just released my IrrPhysx wrapper yesterday so feel free to have a fiddle around with the examples, attach the camera to an object and see what happens, i didn't see any jitter with my quick test before.

This is the code i'm using to convert from Physx transformations to Irrlicht transformations:

Code: Select all

core::vector3df pos;
core::vector3df rot;

NxVec3 p = Actor->getGlobalPosition();
pos.X = p.x;
pos.Y = p.y;
pos.Z = p.z;

NxMat33 m = Actor->getGlobalOrientation();
NxF32 fM[16];
m.getColumnMajorStride4(fM);
core::matrix4 irrM;
irrM.setM(fM);
rot = irrM.getRotationDegrees();

node->setPosition(pos);
node->setRotation(rot);
Incidentally another useful conversion is a Irrlicht rotation vector to a Physx rotation matrix, solved some nasty problems for one person at least!:

Code: Select all

core::vector3df rot; // the rotation vector to be converted
NxMat33 mat; // the matrix to receive the conversion

NxMat33 rotX, rotY, rotZ;
rotX.rotX(rot.X * core::DEGTORAD);
rotY.rotY(rot.Y * core::DEGTORAD);
rotZ.rotZ(rot.Z * core::DEGTORAD);
mat = rotZ * rotY * rotX;
Image Image Image
Slaine
Posts: 120
Joined: Fri May 04, 2007 12:28 pm

Post by Slaine »

Thanks for the code, and the offer to dive into your wrapper, I'll give that code a run at lunch :)
netkoji
Posts: 10
Joined: Sun Feb 01, 2009 1:32 pm

Post by netkoji »

Slaine, did you manage to fix the problem? I'm experiencing exactly the same thing right now. I'm using irrPhysX and have no idea how to get rid of the jitter. This is the code I'm using:

Code: Select all

	void SomeObject::update() {
		core::vector3df vec, rot;
		// Update the node's position to that of the physx object
		PhysxObject->getPosition(vec);
		PhysxObject->getRotation(rot);
		irrNode->setPosition(vec);
		irrNode->setRotation(rot);
		irrNode->updateAbsolutePosition(); // tried without it too, didn't work

		camera->setPosition(vector3df(0, 25, -45)); //this is a relative position to the irrlicht node
		camera->setTarget(irrNode->getAbsolutePosition());
}
This function is being executed right after a call to physxManager->simulate() and physxManager->fetchResults()
Post Reply