how to load skinned model + multiple anims recap

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
cosmo
Posts: 17
Joined: Sat May 06, 2017 1:29 pm

how to load skinned model + multiple anims recap

Post by cosmo »

Hi,
after I took a sneak peaks in the Forum, I need some recap explanation about this topic: how to correctly load skinned model with multiple animations into Irrlicht apps.
If I didn't misunderstand, IrrAssimp doesn't support animated model, as it's stated in the Github page of that project.
So it's mandatory to use .md2 or .b3d file format.
I use Blender to export skinned mesh with multiple animations (stored in NLA editor) as .b3d file (I can't find any valid Blender addons for .md2).
So I made some attempts, which briefly summarize as follow.
Since I have encountered some issue using the latest Blender releases (the mesh appears to be distorted in Irrlicht), I tried some older versions. With Blender 2.79 the mesh is perfectly fine.
But some animations, seem not to work properly, compared to how it appear in Blender 2.79.
Particulary walk and run animations show some artifacts, like if some keyfremes have been oddly modified, once exported in Irricht.
Any sugggestions?
Thanks for your support end your explanations.
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to load skinned model + multiple anims recap

Post by CuteAlien »

Sadly I don't know a good pipeline for animations from Blender. B3d had been the best option for a while. If you have a test-model and give me a link to the exporter you are using I can take a look.

I think there was a recent post of someone who had updated the b3d exporter for newer Blender. Unfortunately I just found out the forum search has a bug and doesn't return all results. Yoran (our admin) is looking into it, might take a bit then I'll try again if I can find that post.

Edit: Yoran managed to fix the search (and even improve it...), sadly I did remember wrong and it wasn't the b3d exporter which got an update but .X - without animations :-( So we're back to - if I get an example I can take a look. Sorry, animation has become a sore point in Irrlicht as I don't use it in my own projects and so we haven't had any real maintainer for the animation system for the last years. All I can do is work on bug reports I get.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Noiecity
Posts: 92
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: how to load skinned model + multiple anims recap

Post by Noiecity »

The animations and the separation of the animations have to be done like "old school", record animations are distinguished by the frames of the animation.

You can for example, have a model in blender with a like only one animation, with 120 frames, but really have 4 animations, each animation occupying 30 frames ( [1] 1->30 - [2] 31->60 - [3] 61->90 - [4] 91->120 ).

https://www.youtube.com/watch?v=fNobespacZ8
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free and in an anonymous way if necessary. You can send me a private message.

https://www.artstation.com/noiecty
**
cosmo
Posts: 17
Joined: Sat May 06, 2017 1:29 pm

Re: how to load skinned model + multiple anims recap

Post by cosmo »

Thanks for your replies and explanations.
I have succesfully exported my mesh with multiple animations in Irrlicht via .b3d file format and Blender 2.79.
Now, I would to perform this kind of task: if W key is pressed, the character stops idle animation and plays the walk anim.
Instead, only some frames of the walk animation is played and updated.
What's wrong?

I put this code in the main loop, between "beginScene" and "drawAll":

Code: Select all

if (inputHandler->IsKeyDown(KEY_KEY_W))
	myChar->setFrameLoop(62,95);
else
	myChar->setFrameLoop(1,60);
Noiecity
Posts: 92
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: how to load skinned model + multiple anims recap

Post by Noiecity »

Code: Select all

		u32 startTime1 = device->getTimer()->getTime();

		u32 startTime2 = device->getTimer()->getTime();

		u32 deltaTime = 0;

		u32 loopCounter1 = 1;
		u32 loopCounter2 = 62;
		
Into while:

Code: Select all

				if (inputHandler->IsKeyDown(KEY_KEY_W))
				{

					loopCounter1 = 1;
					deltaTime = device->getTimer()->getTime() - startTime1;
					if (deltaTime >= 16)
					{
						loopCounter2++;

						if (loopCounter2 >= 95)
						{
							loopCounter2 = 62;
						}
						MyChar->setCurrentFrame(loopCounter2);
						startTime1 = device->getTimer()->getTime();
					}
				}
				else
				{
					loopCounter2 = 62;
					
						deltaTime = device->getTimer()->getTime() - startTime2;
						if (deltaTime >= 16)
						{
							loopCounter1++;

							if (loopCounter1 >= 60)
							{
								loopCounter1 = 1;
							}

							MyChar->setCurrentFrame(loopCounter1);
							startTime2 = device->getTimer()->getTime();
						
					}
				}
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free and in an anonymous way if necessary. You can send me a private message.

https://www.artstation.com/noiecty
**
Post Reply