New Animation System for Irrlicht

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, you just take the loader from my patch page. There are several mesh loaders which are not yet complete, but all are ready to use (modulo porting from Irrlicht 1.1 to latest version).
ri0t
Posts: 6
Joined: Fri Jun 22, 2007 12:04 pm
Location: Germany

Post by ri0t »

Hi there,

I'm interested in adding animation support for the collada file format. For that I've checked out the current animation branch from SVN. I'm having problems with compiling it though. I'm getting various compile errors in the files xdebug and xlocale.

As far as I understand these files come with every visual studio installation. I'm pretty sure that my visual studio files are okay though, because if I check out the trunk files, I can compile Irrlicht without a problem. Has somebody noticed a similar problem?

Thanks in advance!

Code: Select all

1>C:\Programme\Microsoft Visual Studio 8\VC\include\xdebug(32) : warning C4229: anachronism used : modifiers on data are ignored
1>C:\Programme\Microsoft Visual Studio 8\VC\include\xdebug(32) : error C2365: 'operator new' : redefinition; previous definition was 'function'

..

1>C:\Programme\Microsoft Visual Studio 8\VC\include\xlocale(338) : fatal error C1003: error count exceeds 100; stopping compilation
Last edited by ri0t on Fri Jun 22, 2007 12:54 pm, edited 1 time in total.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

ri0t:

Strange error, hmm, check that you have included all the new files into your project, I'm not using visual studio so the visual studio project is out of date.
ri0t
Posts: 6
Joined: Fri Jun 22, 2007 12:04 pm
Location: Germany

Post by ri0t »

Hello Luke,

thanks for your quick response! I think the compile errors were caused by the inclusion of <iostream> in the file CAnimatedMeshSceneNode.cpp. Without the line the project compiles fine. Is there a reason for that line?

Only problem left was that CBoneSceneNode.h/cpp were not included in the VS project.

Thanks again.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

alexionne:

Well the two files like CB3DMeshLoader.cpp, and CB3DMeshLoader.h will be all your loader should need. I can help you with anything you need
I've implemented really lot of LW-specific features so far
Could you list these features, I'll see if then can be in the generic skinnedMesh
alexionne
Posts: 55
Joined: Fri Jun 22, 2007 9:55 am
Location: Novi Sad, Serbia

Post by alexionne »

I've just dowloaded /branches/SkinnedMesh and lwo-patch, so I'll have a look at it these days.

Luke wrote:alexionne:
I've implemented really lot of LW-specific features so far
Could you list these features, I'll see if then can be in the generic skinnedMesh
Please, take a look at http://node.mindnever.org/
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

just an update to show the project is not dead.

-transitions are now working

-the meshes can use animations from other meshes.

-me and bitplane have converted over the ms3d loader to use skinnedmesh
kburkhart84
Posts: 277
Joined: Thu Dec 15, 2005 6:11 pm

Post by kburkhart84 »

Luke wrote:just an update to show the project is not dead.

-transitions are now working

-the meshes can use animations from other meshes.

-me and bitplane have converted over the ms3d loader to use skinnedmesh
Sweeeeeet!!!
ri0t
Posts: 6
Joined: Fri Jun 22, 2007 12:04 pm
Location: Germany

Post by ri0t »

Hello Luke,

I were able to write an importer for Collada using your skinning code and the FCollada library. Thanks a lot for your code!

By the way, I think I found a bug in the bounding box calculation. In file iskinnedmesh.h - method recalclulateBoundingBox - you're falling through the cases of the switch-statement, which most often causes the bounding box of the created mesh to be empty.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

I were able to write an importer for Collada using your skinning code and the FCollada library. Thanks a lot for your code!
Nice work, you plaining on releasing it? But is the FCollada library usable with irrlicht's? It might have to be an external loader.
By the way, I think I found a bug in the bounding box calculation. In file iskinnedmesh.h - method recalclulateBoundingBox - you're falling through the cases of the switch-statement, which most often causes the bounding box of the created mesh to be empty.
Thanks for finding that, lol pretty bad, committed the fix now.
ri0t
Posts: 6
Joined: Fri Jun 22, 2007 12:04 pm
Location: Germany

Post by ri0t »

Luke wrote:
I were able to write an importer for Collada using your skinning code and the FCollada library. Thanks a lot for your code!
Nice work, you plaining on releasing it? But is the FCollada library usable with irrlicht's? It might have to be an external loader.
Using a external library is not Irrlicht's style but it was much easier for me this way. Not sure what I'm going to do with the loader when I'm done.
Luke wrote:
By the way, I think I found a bug in the bounding box calculation. In file iskinnedmesh.h - method recalclulateBoundingBox - you're falling through the cases of the switch-statement, which most often causes the bounding box of the created mesh to be empty.
Thanks for finding that, lol pretty bad, committed the fix now.
No problem, I'm currently having another problem :-) Is it possible to reuse the same skinned mesh by attaching it multiple AnimatedMeshSceneNodes? I've tried this and I'm having problems with the animation. Sometimes it works nice, but sometimes a joint transformation from one node is also used with the other node.

For example, when loading a model and attaching it to two animatatedmeshscenenodes, the first node is animated correctly, but the second one uses a mix of his own joint positions and the joints that the other node just moved.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

Is it possible to reuse the same skinned mesh by attaching it multiple AnimatedMeshSceneNodes?
Yes definitely, I've played around with 100 or so nodes sharing one mesh, no problems.
Sometimes it works nice, but sometimes a joint transformation from one node is also used with the other node
.

that could happen if the mesh doesn't have animation were your animating and your not using any bone control, but that's not really a problem, it might be something else

Strange, could you send me an example. and can a have a look at the loader?
ri0t
Posts: 6
Joined: Fri Jun 22, 2007 12:04 pm
Location: Germany

Post by ri0t »

Luke wrote:
Is it possible to reuse the same skinned mesh by attaching it multiple AnimatedMeshSceneNodes?
Yes definitely, I've played around with 100 or so nodes sharing one mesh, no problems.
Sometimes it works nice, but sometimes a joint transformation from one node is also used with the other node
.

that could happen if the mesh doesn't have animation were your animating and your not using any bone control, but that's not really a problem, it might be something else

Strange, could you send me an example. and can a have a look at the loader?
Hi Luke,

thanks for your reply. I'm sorry I didn't exactly get what you were saying. I'm importing a Collada mesh with it's animation keys.

Here's the relevant code:

Code: Select all

pJoint = pSkinController->GetJoint(iJoint);

for (int k=0; k<keys.size(); k++)
				{
					core::vector3df translation;
					core::vector3df rotation;
					core::vector3df scale;

					ConvertColladaToIrrlicht(matrices[k], translation, rotation, scale);
					rotation *= core::vector3df(-1, -1, 1);

					// we can be careless here because SkinnedMesh removes unneeded keys automatically
					CSkinnedMesh::SPositionKey* posKey = mesh.createPositionKey(pIrrJoint);
					posKey->frame = keys[k] * 30; // HACK
					posKey->position = translation;

					CSkinnedMesh::SScaleKey* scaleKey = mesh.createScaleKey(pIrrJoint);
					scaleKey->frame = keys[k] * 30; // HACK
					scaleKey->scale = scale;

					CSkinnedMesh::SRotationKey* rotKey = mesh.createRotationKey(pIrrJoint);
					rotKey->frame = keys[k] * 30; // HACK
					rotKey->rotation = core::quaternion(irr::core::PI/180.0f*rotation);
				}

				
After that I attach the mesh to multiple IAnimatedMeshSceneNodes, which I then add to the root scene node. By this the animation starts automatically. When I now set the current frame of one node to another value, the animated nodes are animated incorrectly.

For example I'm using a simple skinned model, where the character lifts his left arm and then his right arm. Now when I run two nodes with the same skinnedmesh at the same time, one node is animated correctly and only has one arm up at all times. But the second node will play an animation where not only his one arm is lifted, but also his second arm.

It looks like his right arm-joint overrides the sekelton right arm-joint correctly, but his left arm-joint isn't changed from the previous animation frame of the other model and appears at the joint-position that the other model used, instead of on the bind pose like the animation is supposed to be.

It seems like joints that aren't overriden by a new animation key will not be changed, thus using a joint position that could be wrong.

I hope I made myself clear. It's kinda hard to explain. I'll see if I can come up with some screenshots or some small code that illustrates the problem.

Thanks again.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

thanks for your reply. I'm sorry I didn't exactly get what you were saying. I'm importing a Collada mesh with it's animation keys.

Here's the relevant code:
well that's not really the code I talking about, but it looks fine, by the way that '* 30' hack is no longer needed as in the new animation system, frames are in floats not ints so interpolation is fine without it.

For example I'm using a simple skinned model, where the character lifts his left arm and then his right arm. Now when I run two nodes with the same skinnedmesh at the same time, one node is animated correctly and only has one arm up at all times. But the second node will play an animation where not only his one arm is lifted, but also his second arm.
so does the animation in the joint completely end (no keyframes) before the animation of the mesh as a whole ends?
It seems like joints that aren't overriden by a new animation key will not be changed, thus using a joint position that could be wrong.
Yeah that's true, and I could easily change so it so it's overwritten by the bind pose, but this may cause problems with animation blending later on.

if the animation in the joints are ending before, or starting after the whole mesh does (I haven't found a b3d and ms3d mesh with this problem) you could fill in the gap by adding an extra keyframe at the start or the end, being the same as the next keyframe there should be no interpolation (speed loss). On second thought, I can easily add this as a check in skinnedmesh and save you the work :)

Edit:

I've added it now, ri0t could you test it for me, I got nothing to test it with
ri0t
Posts: 6
Joined: Fri Jun 22, 2007 12:04 pm
Location: Germany

Post by ri0t »

Works like a charm, Luke. Thanks a lot!
Post Reply