MS3D groups without bones bug

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

MS3D groups without bones bug

Post 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?
Amt0571
Posts: 128
Joined: Mon Mar 06, 2006 6:29 pm

Post 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.
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post 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?
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

My model is not animated!
This can cause the error?
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post 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
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post 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.
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post 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?
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post 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?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post 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 :)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post 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!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post 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.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post 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
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe it was just the (strange?) initialization of the default matrix. Why not leaving it as the identity matrix?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post 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.
Post Reply