How did Runic Games do it ?

TaylorMouse

28-12-2009 14:37:33

Hi, I've been wondering for a few things, I'm quit new at this...

I used the models from Runic Games super Torchlight game.

But I don't seem to find how to change from one animation to another ???

I have the following files :

player.mesh
player.material
player.skeleton

the material file contains the texture ( png or dds ) -> works fine
loading the player.mesh -> ok also
player.skeleton -> contains 1 animation ( wich is exctually no animation at all ) with the name bind

but all the other animations are in different files.
ex.

attack_1.skeleton
die_1.skeleton
etc.

I don't seem to get how I change the animation from that player.skeleton to any of the others.

any ideas ??

T.

TaylorMouse

12-01-2010 08:45:25

BUMP-

for now I just copy the content from the other skeleton files to one and then extract the names of the animation, that works... sort of cause the run animation does not seem to be able to work correctly... anyway I'm busy with doing some fx like they did in World Of Warcraft using the material file only, with my little knowledge I have, it is coming along quite well.

The only thing that sucks is the animation, wel getting in from 3DS MAX into MOGRE....


T.

smiley80

12-01-2010 12:45:56

You can change skeletons with 'Mesh.SkeletonName'.

TaylorMouse

12-01-2010 19:47:15

What do you mean ??

can you give an example plz

Thx
T.

smiley80

12-01-2010 20:06:43

Something like this (untested):
Entity e = sceneMgr.CreateEntity("player", "player.mesh");
e.GetMesh().SkeletonName = "attack_1";

TaylorMouse

16-01-2010 22:24:24

If I use that code, it gives me a memory access violation runtime error ....

How do you guys use animated meshes anyway ?????
Don't seem to find anything about this on the forums nor the internet ...

T.

TaylorMouse

01-02-2010 14:27:10

Ok, I did find out how to swap from one file to another ( animation file that is .skeleton )
now the animation sucks big time cause the intial pose is completely different... still working on that...


T.

Rothir

17-03-2010 03:46:53

I got around this initial problem. I'm not using MOGRE though, but I'm sure there is something similar. The way you load the additional animations is like this (in C++):

SkeletonPtr s = mesh->getSkeleton();
s->addLinkedSkeletonAnimationSource("Walk.SKELETON");


Now this gives by far the cleanest results, and for some models (tarantula and burrower at least) it works perfectly. For other models there are still animation problems although it looks a million times better than replacing the original skeleton because the initial binding is all wrong when you replace. The problem now is that the blending weights seem to be wrong. For example when loading the Troll mesh you get a warning saying:

WARNING: the mesh 'troll.MESH' includes vertices with more than 4 bone assignments. The lowest weighted assignments beyond this limit have been removed, so your animation may look slightly different. To eliminate this, reduce the number of bone assignments per vertex on your mesh to 4.

Upon dumping the mesh to xml you definitely see vertices in the original 'bind' animation that have too many weights. I've played around with different things but just can't get it right. The Troll walks without being distorted, but his legs just don't move exactly right. Obviously there is something I'm missing, since the animations look fine in game. Any ideas?

EDIT:

I just saw your other post: http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=11959. I tried loading the dog model and attaching both the walk and run animations. The run looks much less distorted than the original screenshot in your other thread, but the dog is one of the models that gives the 'more than 4 bone assignments' warnings. This means that although close, the animation is still not 100% of what it is in game. I've been beating my head against this for a bit now and am up against a wall. Your threads are the only I've found on this topic so far.

ccckblaze

28-01-2013 03:22:54

the same problem with me.
i solved this problem with the function _mergeSkeletonAnimations, here is my code, a function.

AnimationStateSet* MergeSkeletons (Entity* MainEntity, Ogre::String SearchSkeleton, Ogre::String GroupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)
{
Ogre::String MasterSkeleton = MainEntity->getSkeleton()->getName();
SearchSkeleton += ".SKELETON";
Ogre::SkeletonPtr pSkeletonMaster = Ogre::SkeletonManager::getSingleton().load(MasterSkeleton, GroupName);
Ogre::SkeletonPtr pSkeletonSearch = Ogre::SkeletonManager::getSingleton().load(SearchSkeleton , GroupName);
Ogre::Skeleton::BoneHandleMap boneHandleMap;
pSkeletonSearch->_buildMapBoneByHandle(pSkeletonSearch.getPointer(),boneHandleMap);
pSkeletonMaster->_mergeSkeletonAnimations(pSkeletonSearch.getPointer(),boneHandleMap);
Ogre::SkeletonManager::getSingleton().remove(SearchSkeleton);
MainEntity->getSkeleton()->_refreshAnimationState(MainEntity->getAllAnimationStates());
return MainEntity->getAllAnimationStates();
}


mainEnt is the dog's entity, SearchSkeleton is Walk.skelton.....etc, pSkeletonMaster is dog.skeleton, AnimationStateSet can help you to operate the animations.