Skeletal animation interpolation problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Skeletal animation interpolation problem

Post by sobieh »

Hello i made a simple code for test. Its nothing fancy just simple example to show what i mean :

Code: Select all

#include <iostream>
#include <windows.h>

#include <irrlicht.h>
#pragma comment(lib, "Irrlicht.lib")

using namespace irr;
using namespace scene;
using namespace video;
using namespace core;

IrrlichtDevice* device;
ISceneManager* smgr;
IVideoDriver* driver;
ICameraSceneNode* camera;

int WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
	wchar_t wcap[256];

	int screenw = 1024;
	int screenh = 768;

	device = createDevice( EDT_DIRECT3D9 , dimension2d<s32>(screenw, screenh) , 32 , false , false );
	if (device == 0) return 1;

	driver = device->getVideoDriver();
	smgr = device->getSceneManager();

	device->getCursorControl()->setVisible(false);

	// Main

	camera = smgr->addCameraSceneNodeFPS(0);
	camera->setPosition( vector3df(0,0,300) );

	IAnimatedMeshSceneNode * node = smgr->addAnimatedMeshSceneNode( smgr->getMesh(".\\data\\test.ms3d") );
	node->setPosition( vector3df(50,50,0) );

	// THERE IS SKELETON ONLY ON THE MESH!
	node->setDebugDataVisible(E_DEBUG_SCENE_TYPE::EDS_FULL);
	
	node->setAnimationSpeed( 3 );

	camera->setTarget( node->getPosition() );

	while(device->run())
	{
		if (device->isWindowActive())
		{
			driver->beginScene(true, true, 0 );
				smgr->drawAll();
			driver->endScene();

			swprintf ( wcap , L"Current FPS %d" , driver->getFPS() );
			device -> setWindowCaption ( wcap );
		}
		else
		{
			Sleep(10);
		}
	}

	device->drop();
	
	return 0;
}
There is the test.ms3d model (skeleton) : http://www.sendspace.com/file/l18c2n

The problem is that the animation isnt smooth between Last > First frame.
It looks like some problem/bug with animation interpolation.
Can anyone tell me what am i doing wrong ? Or maybe its a bug ?

Edit: Its not a ms3d format bug, i tested b3d also and it looks exactly the same.
Please check that problem before you reply in a "maybe set frameloop" style ;) I already did all i could to fix that and im stuck.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

didnt try out but maybe IAnimatedMeshSceneNode::setTransitionTime(f32) help?
i use that with 0.2f.
Image
Image
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Post by sobieh »

Already tried that. Looks exactly the same.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Did you check with latest SVN versions? We have had a bug in the last frame calculation which might cause this.
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Post by sobieh »

I did on rev 2545 and still the same or even worse because frame 0 seems to be empty.
I think there is still some bug causing it.

Btw :
How should i use the CollisionManager with ISceneNode *& ? (preety weird declaration ... at least on MSVC v9).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

An ISceneNode*& is a pretty usual declaration. This is what C usually makes an **, i.e. a pointer which can be changed in the method (not just the thing that is pointed to).
I'll check your mesh. Are you sure it has a frame 0?
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Post by sobieh »

Its the ony way i can save the MS3D file (MilkShape 1.8.4) so it should be saved correctly.
About *& ... i forgot to add "const" in my variable declaration :P
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Post by sobieh »

So ... did you checked it ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, there's one frame that is completely broken. Just load the file in the mesh viewer, enable skeleton debug and you will see.
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Post by sobieh »

Yes, there's one frame that is completely broken. Just load the file in the mesh viewer, enable skeleton debug and you will see.
Yea i already figured out that one frame is broken at First post on this thread ... thats the reason why i created it.

Can you tell me what frame is broken and why is that ?
The model seems to be ok on MS3D.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, I don't know much about character animation. But your mesh does not show up at all (besides the skeleton, which does), are you sure it's a properly exported mesh?
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Post by sobieh »

I told that on Post 1 :
There is the test.ms3d model (skeleton) : http://www.sendspace.com/file/l18c2n
Its only a Skeleton without any Mesh. Its used for skeletal animation of other meshes by EJUOR_CONTROL but its not the point here.

The problem is that it animates wrong ... no matter it has mesh or not.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Heh, you cannot imagine how bad some people write their postings. Yours is not much different, if you'd have written that it's a skeleton only I might have remembered. Now I was just sure that there is some kind of skeleton...
Anyway, it's fixed in latest SVN/trunk revision.
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

Post by sobieh »

Ok im sorry that i made it not clear enough.

I see you added
k->frame = kf->Time * framesPerSecond-1;
Now its fixed. Thanks alot for helping.

I have another question (just to not create another thread):
Do you know where i can find Irrlicht's NormalMap/ParallaxMap shader made on HLSL ?
I dont quite understand how shader asm works yet (preety much different than x86 asm).

Im trying to learn it and Irrlicht seems to be a best example.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Its in the source folder, you should look around there first.

CD3D9ParallaxMapRenderer.cpp
Post Reply