New Animation System for Irrlicht

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
gheft
Posts: 34
Joined: Mon Jul 30, 2007 4:11 am

Post by gheft »

this is what view hierarchy shows me in the directx mesh viewer, this must be what you are talking about when you say there is no nesting. This is what happens when I export from Panda with "Top Frame Only"
Image
exporting with "Sub Frame Hierarchy" checked gives me this. A nested hierarchy but with "Unnamed frame" for each joint.
Image

the thing is, both give me the same result loaded into irrlicht. one bone sticking straight up, and getJointNode->getAbsolutePosition() returning the same point for every joint
Image
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

could you send me the mesh with Sub Frame Hierarchy?
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Posting to report an issue I found that is present in the old animation system, and is present in a different form in the new animation system. I discussed this with hybrid and he suggested I post it, along with anything else different in my game between animation engine versions.

Old engine:
I have a bunch of animated mesh scene nodes in my game that share a common mesh. There appears to be an issue with sharing a mesh and bounding boxes as any time I kill a monster and he falls down, all the other monsters in the game have their bounding box flicker between the lieing down on the ground one and the standing up one. Sometimes they go back to the standing up one sometimes they remain lieing down. The common thing is wherever they stay, they are all the same. So you will either have a bunch of monsters with on the ground boxframes even though most of them are standing up, or they will all be standing up even though some of them are lieing down. These are ms3d meshes btw.

Here is the code to create a monster:
IAnimatedMeshSceneNode *node;
IAnimatedMesh *mesh = myGameSceneManager->getMesh("models/zombie.ms3d");
node= myGameSceneManager->addAnimatedMeshSceneNode(mesh);
node->setScale(vector3df(1.6f,1.6f,1.6f));
node->setMaterialTexture(0, myGameDriver->getTexture("textures/zombie.jpg"));
setDefaultMaterialFlags(node);
node->setAnimationSpeed(400);
node->setAnimationSpeed(30);
//node->setFrameLoop((u16)(2.0f*ANIMATION_MAGIC_NUMBER),(u16)(20.0f*ANIMATION_MAGIC_NUMBER));
node->setFrameLoop(2,20);
//node->setCurrentFrame((u16)(2.0f*ANIMATION_MAGIC_NUMBER));
node->setCurrentFrame(2);
node->setLoopMode(true);
return node;

New engine:
The bounding boxes in the above situation are always the standing up one. They never lie down when shot(even though graphicaly the monster does fall down as normal). The only code change for the new engine is changing the frame speed to get rid of the magic number bit

Old engine:
The gun(A ms3d model converted from a halflife 2 mdl) is in the center of the screen 2 hands holding a pistol. The gun is a single animated mesh scene node from an ms3d file. It is attached to the camera and given a position offset.

Here is the code that makes this gun:
IAnimatedMesh *mesh = myGameSceneManager->getMesh("weapons/pistol/pistol.ms3d");
ISceneNode* node= myGameSceneManager->addAnimatedMeshSceneNode(mesh);
String textureNames[]={"weapons/pistol/hand.bmp","weapons/pistol/thumb.bmp","weapons/pistol/pistol_I.bmp","weapons/pistol/pistol_II.bmp"};
applyTextures(node,4,textureNames);//Helper function i wrote that just puts textures on
setDefaultMaterialFlags(node);
return node;

and then later on in the code
equippedWeapon->getSceneNode()->setParent(weaponAttachSceneNode);//Where weapon attach scene node in this case is the camera
equippedWeapon->getSceneNode()->setPosition(weaponAttachOffset);//some offset
equippedWeapon->getSceneNode()->updateAbsolutePosition();
New engine:
The gun is off to the left and only one hand is visible.

I have some screenshots of this if you would like them let me know where to send them. I don't have anywhere to host them atm to link them on this post.

Please let me know if there is any other information or work i can do to help you diagnose this. I can send you this code but its huge so it might be painful.
tmighty
Posts: 4
Joined: Sun Aug 05, 2007 6:36 pm

Go for it!!

Post by tmighty »

Dear Luke,

I cannot wait to use your animation system!!

Best greetings.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Haven't tried, but yup, it looks like exactly what I'm looking for ^^ Thanks again Luke. Great work ( like many in the community). You guys make Irrlicht lives ^^
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Oh I have a question in addition for Luke, or whoever. I read through this entire thread and I didn't see anyone talking about this so hopefully I am not asking a duplicate question.

The current ray tracing functions. It would be awsome if there was a way to get the join that a line intersects with. Right now I believe you can only get the triangle or the scene node.

I would love to be able to do body part specific collision detection for my game's projetiles.

I don't know much about how your code works so there might be a really good way to do this, but one option would be to just take the center of the triangle, and iterrate through all of a scene node's joins and find the one that is the closest. There is a chance for picking the wrong joint though if a bunch are close together. If you have something better though let me know.
Last edited by kendric on Tue Aug 07, 2007 2:19 pm, edited 2 times in total.
gheft
Posts: 34
Joined: Mon Jul 30, 2007 4:11 am

Post by gheft »

Luke:
http://www.sendspace.com/file/62ozwf

actually I just tried loading this again and the debug skeleton does appear, except the joint sticking straight up is still there, and I can't get any usable joint positions.

For moving joints, I can't move them with setPosition. Has this been implemented yet, or is it just a problem with my mesh?
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

The bounding boxes in the above situation are always the standing up one. They never lie down when shot(even though graphicaly the monster does fall down as normal). The only code change for the new engine is changing the frame speed to get rid of the magic number bit
yeah I was talking to bitplate, about this, the bounding box is mainly used for culling, not really picking. you could try manually setting the bounding box per node, but the plain irrlicht will overwrite any value (skinnedMesh should be fine)

irrlicht made the culling of animated meshes completely pointless (in fact it's alot slower then not culling at all), which is fixed in skinnedMesh and 1.3.1, I'd like a better way to fix it, but I cannot think of any.
The current ray tracing functions. It would be awsome if there was a way to get the join that a line intersects with. Right now I believe you can only get the triangle or the scene node.
well normally this is done in a physics engine, along with ragdolls. The animation system doesn't know how wide, or what shape the joints should be. And a physics engine would also be a lot faster at ray casting then irrlicht.

But if you had the triangle id, I could get the animation system to return which joint is affecting it, so you take a different hp off based on it or something, by this is not what most games do, it's pretty slow with a few meshes.

gheft, I'll reply to you later, it's to late now...

but yes, setPosition has been implemented...

thanks for the comments :D
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Thanks for the answer Luke. I have 2 comments that maybe you can shed some light on.
As far as the bounding boxes go:
I use the bounding box check in the same way the irrlicht engine(atleast the 1.3.1) does, in picking. So does that code need to be changed as well? If you look at:
getSceneNodeFromScreenCoordinatesBB
which calls:
getPickedNodeBB
which does:
const core::aabbox3df& box = current->getBoundingBox();
if (box.intersectsWithLine(line))

What I really want is a way to screen scene nodes rather then doing a triangle test on every single one.

This falls into the 2nd comment, you mention using the physics engine to do these things. It seems to me that all the animation art work is moving meshs around, and you would have to move the physics model every frame to match the mesh. There are 2 big issues here. I am using newton and your supposed to apply forces to move things. I don't know how warping things around will effect the realisitic ness of things. The 2nd issue is matching up complex joint movement and physics bodies to match. With joints its more possible now but like in 1.3.1 there would be no way to match body parts from the mesh with physics bodies to synch them up. This is why I chose to ray trace in the scene node side of things, and just let physics control rotation and position.

Moving to a 100% match of what you see on screen with scene nodes and what your bodies are in your physics engine is a task that seems very daunting to me. What I have now is basically a simple cylinder for character models and then more complex shapes can easily exist for non animated scene nodes. All ray tracing is done scene node side and then the user always sees what they expect and you don't have bullets passing through body parts.

Phew that was long winded.

So to sumarize if bounding boxes are no good, and I want to stay scene node side, what do you suggest i use for ray tracing screening to avoid a hundred triangle selector tests each frame. And finally you mention if I have the triangle ID, the triangle3d class has no ID that I can see. Its just a collection of points. Thats what i get back from the getTriangle function in irrlicht.

If you made it all the way to the bottom of this post, thank you very much :) and Thanks for you hard work.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

gheft:

well the problem seems to simply be the scaling on the bones, some of the code is uncomment be cause it was causing problems. it's hard because some x meshes only work fine when you ignore scaling and some only work (like yours) when you don't. I would like to fix it proper, but exporting the mesh without any bone scaling will fix the problem.


kendric:
The gun is off to the left and only one hand is visible.
yeah that's weird I'd like to have a look


yeah the physics can be pretty tricky.
And finally you mention if I have the triangle ID, the triangle3d class has no ID that I can see.
yeah that's true, you could change the function to give you the id.

but there is still the problem with updating the triangle selector as the mesh updates, it's pretty slow.

I could add a ray picking function to AnimatedMeshScene, it wouldn't be the fastest function in the world, but faster then updating and using a triangle selector. But that would be after skinnedMesh is complete.
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

yeah that's weird I'd like to have a look
How do you want it, email, etc, and what do you want. I can give you exe,screenshot,source(huge and you would need many libraries to compile it).
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Oh and I meant to add another piece of info on my selection issue. When I was seeing the bounding box thing, I tried as a workaround for fun getting the frame of the mesh and generating a fresh triangle selector. I still seemed to see behaviour where it wouldn't detect collisions right when one guy was lieing down and one was not.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

LW Loaders?! Alexionne?

Post by christianclavet »

Hi!

Great for this new animation system! Is it true Alexionne?! You would implement LW loaders!?? :shock:

Im working primiraly with this, this would be more than great to use this! I would load a mesh with bones and animate it directly :lol:
alexionne
Posts: 55
Joined: Fri Jun 22, 2007 9:55 am
Location: Novi Sad, Serbia

Re: LW Loaders?! Alexionne?

Post by alexionne »

christianclavet wrote:Hi!

Great for this new animation system! Is it true Alexionne?! You would implement LW loaders!?? :shock:
I've already started working on it. I'm currently implementing loading of VMAD chunks (discontinuous vertex mapping), and hope to find some nice way of implementing skeletal animation support. Also, I'll try to improve material support for LWO objects, if present Irrlicht design allows it.

EDIT: There's already partially working LWO loader at http://parsys.informatik.uni-oldenburg. ... rmats.html, I've used is as a base for my work.

Best,
Aleksa
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

LWO is well suported for objects quite ok by wings and blender.
WOuld be great :)
Finally making games again!
http://www.konekogames.com
Post Reply