Page 1 of 1

MS3D groups without bones bug

Posted: Thu Nov 02, 2006 10:14 am
by Magnet
I review forum but not found answer for my qustion.
Please help me.
I am found bug report for X Model Player. But my version of IrrLicht has fix for this bug.
But I can not obtain normal result.

I am create model with bones.
After I am load it in my project.
I add Cubes to my scene to joints possitions.
This cubes have incorrect positions!!! My scene in 3D Max has other positions.
Are the bones functional in the X-model or MS3D model?

Posted: Thu Nov 02, 2006 6:16 pm
by Amt0571
A few months ago I did tests creating models with bones in Milkshape and animating them. I exported them to .x, and ran them through DirectX mesh viewer.

After this process Irrlicht loaded the model correclty with the animation.

Posted: Thu Nov 02, 2006 10:39 pm
by Magnet
I am create MS3D object:
Image
http://www.webpolit.com/irr/123.ms3d

After I am load model, and try to get joint positions.

Code: Select all

rod = (IAnimatedMeshMS3D*)smgr->getMesh("../storage/123.ms3d");	
	smgr->addAnimatedMeshSceneNode(rod);
	int c = rod->getJointCount();
	for (int i=0;i<c;i++)
	{
		core::matrix4 *pmatTest = rod->getMatrixOfJoint(i, 0);
		vector3df pos= pmatTest->getTranslation();		
	}
But line
core::matrix4 *pmatTest = rod->getMatrixOfJoint(i, 0);
is return NULL.
Why?

Posted: Thu Nov 02, 2006 10:50 pm
by Magnet
My model is not animated!
This can cause the error?

Posted: Thu Nov 02, 2006 11:09 pm
by Magnet
I am create new animated model:
Image
http://webpolit.com/irr/111.ms3d

And this code in main loop for display bones.

Code: Select all

int c = rod->getJointCount();
	vector3df start, end;

	for (int i=0;i<c;i++)
	{
		core::matrix4 *pmatTest = rod->getMatrixOfJoint(i, 0);
		end= pmatTest->getTranslation();
		if (i>0)
		{
			driver->draw3DLine(start, end, SColor(255,255,0,0));
		}
		start=end;
	}
And take this results:
1. Model is displayd.
2. Model is aminated.
3. I have accesse to bones and its matrix

But I have other scene in my game :-(
Image

Posted: Fri Nov 03, 2006 2:05 pm
by rogerborg
Ah, yes, in version 1.1, ms3d models don't return joint information unless the mesh is animated. This has been fixed in the latest subversion source so that it returns the initial joint matrices for non-animated models, regardless of the frame number you supply.

If you just want the joint positions, then you may be able to work around it in 1.1 by using IAnimatedMeshSceneNode::getMS3DJointNode(), then getting the position of the returned ISceneNode (then dropping it if you don't need the scene node itself), although I haven't tried that.

Posted: Fri Nov 03, 2006 5:56 pm
by Magnet
If you just want the joint positions, then you may be able to work around it in 1.1 by using IAnimatedMeshSceneNode::getMS3DJointNode(), then getting the position of the returned ISceneNode (then dropping it if you don't need the scene node itself), although I haven't tried that.
Yes. I am create animated model :-) and I access to joints with getMS3DJointNode now.

But I have other problem:
I bind object to bone in 3DSMAX and export scene to ms3d file.
Then I open ms3d in milkshape, and take normal model, but if I load model in IrrLicht object, which binded to bone, is located not on its place.

Screenshot on Milkshape:
Image

Screenshot on my project:
Image
Boxes is my joints.

Why the spool is not located on its place?

Posted: Fri Nov 03, 2006 8:49 pm
by Magnet
Can objects do not save the rotating vector?
Probably this so!
Becouse, I am change scene to:
Image

And take this:
Image

The rod is using joint animation, but other objects not have it.
My scene:
http://webpolit.com/irr/rod.ms3d

It is bug?

Posted: Sat Nov 04, 2006 4:36 am
by bitplane
looks like ms3d doesnt hold information for the positions of groups (at least in the ascii format), so i'm guessing irrlicht's ms3d loader changes each bone matrix as it loads them, leaving everything that isn't attached to a bone in its original position.
this would also explain why you see the mesh flip around before the animation starts.
this is a bug, so i'm moving this topic to bug reports and renaming it
thanks for the test models, and such detailed bug reporting, i'll try and get it fixed :)

Posted: Sat Nov 04, 2006 9:35 pm
by bitplane
okay i think i fixed this, it works with the 10 or so ms3d files i had lying around my drive, plus the ones you provided and a couple of test cases.
committing to svn, please post a link to anything that it breaks!

Posted: Mon Nov 06, 2006 10:54 am
by rogerborg
You sunk my battleship!

Image

Well, capsized my destroyer anyway. I forgive you, but I don't know if the brave men of the z1.ms3d can.

This is with svn 282. The positions of the bone nodes are correct (note the guns floating in the air, at the expected positions), but the models have been rotated 90 degrees counterclockwise around their Z axes and 180 around their Y axes compared to the previous behaviour (the ship points backwards, and the guns now point in towards the centre of the ship).

Code for this example (sans the sky and water textures). Previously (around 275 or so), the models appeared as I would have expected based on the Milkshape views.

Posted: Mon Nov 06, 2006 10:16 pm
by bitplane
i've reverted back to how it was for the time being, so the original bug still stands. i thought the fix was a bit crappy it seemed to work on all the meshes i tried :s

Posted: Mon Nov 06, 2006 10:59 pm
by hybrid
Maybe it was just the (strange?) initialization of the default matrix. Why not leaving it as the identity matrix?

Posted: Tue Nov 07, 2006 10:49 am
by rogerborg
Image

The crew of the z1.ms3d salute you, sir.

I wish I had the time to look into this, but I'm literally holding the baby at the moment, and the next thing on my list is local lights.