Animated DirectX model - animation problems
Animated DirectX model - animation problems
I have a problem with importing animated DirectX moedels into Irrlicht.
In 3D Studio Max 8 I created a plane with 50x50 polygons and applied animated noise to it. Then I exported the animation using the Quest3D exporter for .X files .
I loaded it into Irrlicht like this:
________________________________________________
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib,"irrlicht.lib")
int main()
{
IrrlichtDevice *irrdev=createDevice(video::EDT_DIRECT3D9,core::dimension2d<s32>(800,600));
video::IVideoDriver* irrvideodriver=irrdev->getVideoDriver();
scene::ISceneManager* irrsmgr=irrdev->getSceneManager();
irrdev->setWindowCaption(L"Luminance Level Editor");
scene::IAnimatedMesh* mesh= irrsmgr->getMesh("x.x");
scene::IAnimatedMeshSceneNode* node= irrsmgr-> addAnimatedMeshSceneNode(mesh);
if(node)
{
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setFrameLoop(0, 100);
node->setMaterialTexture( 0, irrvideodriver->getTexture("texture.bmp") );
}
irrsmgr->addCameraSceneNode(0, core::vector3df(0,30,-40),core::vector3df(0,5,0));
while(irrdev->run())
{
irrvideodriver->beginScene(true,true,video::SColor(255,0,0,255));
irrsmgr->drawAll();
irrvideodriver->endScene();
}
irrdev->drop();
return 0;
}
_________________________________________________
I hope that you can understand the code easily...
Now... my problem is :
The mesh loads. But it doesn't animate
I think I haven't used the correct method... I've looked through the documentation and I stumbled upon a function IAnimatedMeshX
Unfortunately I haven't got the faintest idea on how to implement it.
The Irrlicht documentation supplies data based on the header... and, shamefully I am not able yet to understand that data.
If someone could point me to the correct solution to this problem... i would be extremely grateful
I mean... the syntax of the function IAnimatedMeshX or something
In 3D Studio Max 8 I created a plane with 50x50 polygons and applied animated noise to it. Then I exported the animation using the Quest3D exporter for .X files .
I loaded it into Irrlicht like this:
________________________________________________
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib,"irrlicht.lib")
int main()
{
IrrlichtDevice *irrdev=createDevice(video::EDT_DIRECT3D9,core::dimension2d<s32>(800,600));
video::IVideoDriver* irrvideodriver=irrdev->getVideoDriver();
scene::ISceneManager* irrsmgr=irrdev->getSceneManager();
irrdev->setWindowCaption(L"Luminance Level Editor");
scene::IAnimatedMesh* mesh= irrsmgr->getMesh("x.x");
scene::IAnimatedMeshSceneNode* node= irrsmgr-> addAnimatedMeshSceneNode(mesh);
if(node)
{
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setFrameLoop(0, 100);
node->setMaterialTexture( 0, irrvideodriver->getTexture("texture.bmp") );
}
irrsmgr->addCameraSceneNode(0, core::vector3df(0,30,-40),core::vector3df(0,5,0));
while(irrdev->run())
{
irrvideodriver->beginScene(true,true,video::SColor(255,0,0,255));
irrsmgr->drawAll();
irrvideodriver->endScene();
}
irrdev->drop();
return 0;
}
_________________________________________________
I hope that you can understand the code easily...
Now... my problem is :
The mesh loads. But it doesn't animate
I think I haven't used the correct method... I've looked through the documentation and I stumbled upon a function IAnimatedMeshX
Unfortunately I haven't got the faintest idea on how to implement it.
The Irrlicht documentation supplies data based on the header... and, shamefully I am not able yet to understand that data.
If someone could point me to the correct solution to this problem... i would be extremely grateful
I mean... the syntax of the function IAnimatedMeshX or something
God is real unless declared integer
-
- Posts: 31
- Joined: Fri Apr 21, 2006 12:00 am
- Location: Australia
I wouldn't bother trying to get it to animate...
I've spent a lot of time on this myself. My conclusion is that you won't be able to get animation to work in the .X format.
I've made some animations (and I mean really simple ones, like a box spinning around), and saved them in .X (with both the Quest3D and Panda exporter). In the DirectX mesh viewer, they play exactly as I planned. In Irrlicht, all I get is the model with no animation.
So instead I've been using the Cal3d format. Do a search on the forum, somebody made a scene node class for Cal3d, and you can get plugins for 3d studio max that will export them in the Cal3d format. It's a bit of mucking around, but I had absolutely no problems with animation - it worked first time for me, no crashes, no weird bugs.
I've spent a lot of time on this myself. My conclusion is that you won't be able to get animation to work in the .X format.
I've made some animations (and I mean really simple ones, like a box spinning around), and saved them in .X (with both the Quest3D and Panda exporter). In the DirectX mesh viewer, they play exactly as I planned. In Irrlicht, all I get is the model with no animation.
So instead I've been using the Cal3d format. Do a search on the forum, somebody made a scene node class for Cal3d, and you can get plugins for 3d studio max that will export them in the Cal3d format. It's a bit of mucking around, but I had absolutely no problems with animation - it worked first time for me, no crashes, no weird bugs.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
But the dwarf is animating, and I've seen several other .x files animating, too. Try to load it with the meshviewer from irrlicht and report the console output if it is not working there. Most problems are related to file parsing errors, so it could be a problem with wrong reading of the animation part. There's also a limit of bones and weights which you might find some more information about with a forum search.
I have seen pretty much every format work at *some* point or other. Having a pre-made "perfect" model working in Irrlicht is one thing. Going from your preferred modeler, out to a .X file, and then into Irrlicht is another story.hybrid wrote:But the dwarf is animating, and I've seen several other .x files animating, too.
So far I have been completely incapable of getting *any* animation data out of Blender and into Irrlicht regardless of format (I know you're talking about MAX, but from what I'm reading here, it seems to have similar problems).
So far, the only way I have been able to get animated data into Irrlicht is using Milkshape. Even then, I found the .X behavior to be somewhat bad with visible "breaks" in the mesh when doing bones. My best luck to date has been exporting a .md2 from Milkshape.
Unfortunately, I hate Milkshape's interface, not to mention it irks my Linux zealotry to use Windows, but that's my .02. The best and quickest way I have found to get animations into Irrlicht is to export a .md2 file from Milkshape.
How were you animating it in Max?
An animation needs to be created in a certain way in order for it to be played as an X file in Irrlicht.
If you are sure you set up the animation corrcelty in Max (or blender or whatever) and it works in the DX mesh viewer but not in Irrlicht, then open it in the DX mesh viewer and save it from there. That will sometimes straighten it out.
good luck
An animation needs to be created in a certain way in order for it to be played as an X file in Irrlicht.
If you are sure you set up the animation corrcelty in Max (or blender or whatever) and it works in the DX mesh viewer but not in Irrlicht, then open it in the DX mesh viewer and save it from there. That will sometimes straighten it out.
good luck
Join us in the Irrlicht chatroom:
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
-
- Posts: 31
- Joined: Fri Apr 21, 2006 12:00 am
- Location: Australia
I've tried loading my .X models in DirectX meshview and then saving them, and they still never animate correctly. Also, when I go to view them in Irrlicht's mesh viewer, the console output is always "Loaded mesh: blah blah blah"
And yet still no animation. Also, sometimes the models look a little funny too (vertices are in the wrong places etc).
And yet still no animation. Also, sometimes the models look a little funny too (vertices are in the wrong places etc).
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
If you get wrong node placement it is often due to missing frame names. Irrlicht requires names for all frames. Search for a forum post where I had discovered this bug. I have not yet fixed this problem as generation of temporary names is no good choice, so instead frame sorting and access has to be changed.
If you provide me with the mesh I can check it for you.
If you provide me with the mesh I can check it for you.
Irrlicht supports only bone animations !!!
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Posts: 31
- Joined: Fri Apr 21, 2006 12:00 am
- Location: Australia
-
- Posts: 31
- Joined: Fri Apr 21, 2006 12:00 am
- Location: Australia
Here is a tutorial that was written with the intent of using a different file format and the UnrealEngine, but the creation method is the same.
Just skip the part about ActorX and PSK file stuff and go right on to the animating with keyframes part - then use the PandaX exporter (search the Irrlicht forums for proper settings on export)
It was written a while ago for Max r5, but the same tools are present.
http://fordy.planetunreal.gamespy.com/g ... ls/16.html
There are other ways with other tools, but this should get you going.
If you still have a problem, post your file and I'll take a look.
One of these days I am going to write a tutorial specifically for x files and Irrlicht.
Just skip the part about ActorX and PSK file stuff and go right on to the animating with keyframes part - then use the PandaX exporter (search the Irrlicht forums for proper settings on export)
It was written a while ago for Max r5, but the same tools are present.
http://fordy.planetunreal.gamespy.com/g ... ls/16.html
There are other ways with other tools, but this should get you going.
If you still have a problem, post your file and I'll take a look.
One of these days I am going to write a tutorial specifically for x files and Irrlicht.
Join us in the Irrlicht chatroom:
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
[url]irc://irc.freenode.net/irrlicht[/url]
I love deadlines. I like the whooshing sound they make as they fly by. -D.Adams
-
- Posts: 21
- Joined: Sun Sep 03, 2006 5:58 am
.X finally working
Acki wrote: Irrlicht supports only bone animations !!!
Not true. I made a simple cube that tilts on its axis. I followed the suggestions and got both the Panda and the Quest exporters for 3DS Max. I'm using Max version 8.
After wasting an entire night trying to get the cube to animate in Irrlicht I tried opening it up in MS MeshViewer and both exporters worked fine. I also tried resaving it with MeshViewer in another name to see if that would straighten things out.
Finaly, I noticed that in Irrlicht it was moving, but incredibly slowly. So I checked the framecount: MsgBox(mesh.FrameCount) 'Returns 4960.
That sounds like a multiple of the 31 frames I created in 3DS Max. Let's see 4960 divided by 31 = 160. Ahh that gives me an idea!
Gee, I wonder what will happen if I multiply the speed I want 30, by 160, and set the animation speed to that product. (.AnimationSpeed = 4800);
Then set the frame loop to 4960 frames, (.SetFrameLoop(0, 4959)
Sure enough, the animation plays in its entirety, at the correct speed. Life is good.
Would someone like to explain this please?
Any ideas?
Not true. I made a simple cube that tilts on its axis. I followed the suggestions and got both the Panda and the Quest exporters for 3DS Max. I'm using Max version 8.
After wasting an entire night trying to get the cube to animate in Irrlicht I tried opening it up in MS MeshViewer and both exporters worked fine. I also tried resaving it with MeshViewer in another name to see if that would straighten things out.
Finaly, I noticed that in Irrlicht it was moving, but incredibly slowly. So I checked the framecount: MsgBox(mesh.FrameCount) 'Returns 4960.
That sounds like a multiple of the 31 frames I created in 3DS Max. Let's see 4960 divided by 31 = 160. Ahh that gives me an idea!
Gee, I wonder what will happen if I multiply the speed I want 30, by 160, and set the animation speed to that product. (.AnimationSpeed = 4800);
Then set the frame loop to 4960 frames, (.SetFrameLoop(0, 4959)
Sure enough, the animation plays in its entirety, at the correct speed. Life is good.
Would someone like to explain this please?
Any ideas?