animation?
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
animation?
Hi
I'm working on some application for animation and I'd like to use Irrlicht to help myself. Now, I need Irrlicht to load the model and I need to be able to access all the data, vertices, meshes, joints... and then I would set the transformations on joints.
I'm not planing to work with predefined keyframe animations.
Since I'm new with Irrlicht I would appreciate any pointers on how to do it.
(like, should I load a model as animated mesh or skinned mesh or something else...)
Thank you
I'm working on some application for animation and I'd like to use Irrlicht to help myself. Now, I need Irrlicht to load the model and I need to be able to access all the data, vertices, meshes, joints... and then I would set the transformations on joints.
I'm not planing to work with predefined keyframe animations.
Since I'm new with Irrlicht I would appreciate any pointers on how to do it.
(like, should I load a model as animated mesh or skinned mesh or something else...)
Thank you
Last edited by butthead_82 on Mon Sep 01, 2008 7:35 am, edited 1 time in total.
Have you seen tutorial 3, custom scene node?
If you can create a custom loader, you could use a custom scene nodo and do whatever you want.
However, I see no problems in loading a mesh using IMeshLoader (see reference api). This interface has a method
virtual IAnimatedMesh * createMesh (io::IReadFile *file)=0
and IAnimatedMesh has a method
virtual IMesh * getMesh (s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1)=0
and finally, this interface IMesh gives you access to the mesh buffer.
You could load a model, take the first frame and manipulate the vertices by yourself.
If you use an skinned mesh (which I think you can load in a similar way), you would be able to code animation based on skeletons. But there is no right way to perform the animation, it depends on your application needs.
I don't know if that helped... But I tried. Good luck.
If you can create a custom loader, you could use a custom scene nodo and do whatever you want.
However, I see no problems in loading a mesh using IMeshLoader (see reference api). This interface has a method
virtual IAnimatedMesh * createMesh (io::IReadFile *file)=0
and IAnimatedMesh has a method
virtual IMesh * getMesh (s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1)=0
and finally, this interface IMesh gives you access to the mesh buffer.
You could load a model, take the first frame and manipulate the vertices by yourself.
If you use an skinned mesh (which I think you can load in a similar way), you would be able to code animation based on skeletons. But there is no right way to perform the animation, it depends on your application needs.
I don't know if that helped... But I tried. Good luck.
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
mvalle wrote:Have you seen tutorial 3, custom scene node?
If you can create a custom loader, you could use a custom scene nodo and do whatever you want.
However, I see no problems in loading a mesh using IMeshLoader (see reference api). This interface has a method
virtual IAnimatedMesh * createMesh (io::IReadFile *file)=0
and IAnimatedMesh has a method
virtual IMesh * getMesh (s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1)=0
and finally, this interface IMesh gives you access to the mesh buffer.
You could load a model, take the first frame and manipulate the vertices by yourself.
If you use an skinned mesh (which I think you can load in a similar way), you would be able to code animation based on skeletons. But there is no right way to perform the animation, it depends on your application needs.
I don't know if that helped... But I tried. Good luck.
Yes, very helpfull, thank you.
I forgot to mention that skeletal animation is in my focus so I'll use skinned
mesh.
I was studying ISkinnedMesh class a bit. It has getMeshBufferCount() method and it returns 3 in my program and I know my model has 4 meshes. It has 3 materials though. Are mesh buffers created for each material?
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
mvalle wrote:I think he said your method should return 4.
I wonder if your model was saved with 3 meshes, even if in your modeler software it appears as 4. Maybe it was your modeler software that chose to merge some mesh buffer...
May it be?
I didn't make that model myself( it's a free model from the web) and I don't use a modeling tool.
The number of 4 meshes is written in .ms3d file.
I also have some ms3d loader I wrote and with it I can see there are 4 meshes, I can choose each mesh and render it.
The model I'm talking about is that dwarf from 8-th and 9-th tutorial.
The meshes are: body, head, axe and those things on shoulders.
Now, what I suppose is that Irrlicht combines meshes with same material to speed up rendering.
Maybe I shouldn't access the meshes through the buffers?
How exactly do I access some mesh in the model? I use ISkinnedMesh, it has getMesh(...) method but the method doesn't have no mesh ID or name as argumet. Could you explain using that method to me a bit?
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
I need to be able to access meshes, vertices and other data to change them if I want to.JP wrote:What do you want to access the buffers for? what is your goal?
a meshbuffer is a collection of vertices which share the same material so it is indeed likely that irrlicht is combining two seperate groups which have the same material.
For example, I have this func.:
// Get position of the vertex at the specified index in the specified mesh.
CVector3 getVertexPos( string& meshId, int index );
or:
//Set position of the vertex at the specified index in the specified mesh.
void setVertexPos( string& id, int index, CVector3& position );
Now, my picture of doing that was accessing the mesh, then it's vertex, but when it groups them I'm concused.
Surely,the engine shouldn't lose information about model's meshes?
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The vertices of skinned meshes aren't supposed to be changed. Instead, you'd change the joints of the skeleton. The dwarf (as given in the .x file in the SDK) has exactly one mesh with three materials. Hence, three meshbuffers are used. There are some dozen joints, though, which you can freely alter and attach things to.
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
One mesh??
I don't know about .x, I use some .ms3d version. Maybe somebody made some changes but in .ms3d format I use there are indeed 4 meshes. Their names are "body", "head", "axe" and "pads".
Is there a method to access a mesh by it's name or ID?
I don't know about .x, I use some .ms3d version. Maybe somebody made some changes but in .ms3d format I use there are indeed 4 meshes. Their names are "body", "head", "axe" and "pads".
True. I wasn't planning changing vertices that are controled by bones. What I need the ability to change them for is morph target method for facial animation (should I implement it later). That's why I want to learn about Irrlicht's data manipulation abilities.The vertices of skinned meshes aren't supposed to be changed. Instead, you'd change the joints of the skeleton.
Is there a method to access a mesh by it's name or ID?
Do you have any plans for how to do facial animation. I've never thought about it before but i'd say the easiest way would be to put some bones in the face and then manipulate those instead of individual vertices.
I've got a squid model that someone made for me which has some pre-animated facial animation in it that's done that way.
I've got a squid model that someone made for me which has some pre-animated facial animation in it that's done that way.
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
There are two aproaches to facial animation as far as I know: the first is by bones as you mentioned. I guess it wasn't as practical for facial animation as it was for body animation so another method was developed: the morph targets.JP wrote:Do you have any plans for how to do facial animation. I've never thought about it before but i'd say the easiest way would be to put some bones in the face and then manipulate those instead of individual vertices.
I've got a squid model that someone made for me which has some pre-animated facial animation in it that's done that way.
With morph targets the face is divided in few regions: mouth, eyes, cheeks... and so on (it's defined by MPEG-4 FBA standard). Then you take mouth, for example, and make a model of closed mouth(it's called neutral position) and a model of opened mouth(called morph target). Then with simple linear interpolation of mouth vertices between those two models you can get any shape of mouth between them(it implies that both models have the same topology). Then you make morph targets for visemes(typical mouth shapes for certain phonemes). The same way you make morph targets for other parts of the face.
Then you go to a higher level and combine those into expressions: happy face, sad face...so on.
That's why I need control over vertices. I wouldn't manualy change every vertex, it would be in some loop where a do interpolation.
So, how do I access meshs and theirs data other then through buffers?
Last edited by butthead_82 on Wed Sep 03, 2008 11:46 am, edited 1 time in total.
you can't, that's where the vertices are stored so you have to do it that way.
what you could do it alter the model loader so that it doesn't add mesh buffers together that shouldn't be, according to your requirements.
so i would suggest you create a new model loader, which is an exact copy of the old one and then make your changes. You might not even have to recompile irrlicht to get it to work as you could just use the model loader in your code rather than smgr->loadMesh.
I guess this would have to be done for every model format you wanted to handle but i think the changes would be pretty minimal.
First job, study the model loader code for your format of choice
what you could do it alter the model loader so that it doesn't add mesh buffers together that shouldn't be, according to your requirements.
so i would suggest you create a new model loader, which is an exact copy of the old one and then make your changes. You might not even have to recompile irrlicht to get it to work as you could just use the model loader in your code rather than smgr->loadMesh.
I guess this would have to be done for every model format you wanted to handle but i think the changes would be pretty minimal.
First job, study the model loader code for your format of choice
-
- Posts: 41
- Joined: Mon Jun 16, 2008 12:20 pm
Oh man...don't tell me i have to do that. I have plenty of work without thatJP wrote:you can't, that's where the vertices are stored so you have to do it that way.
what you could do it alter the model loader so that it doesn't add mesh buffers together that shouldn't be, according to your requirements.
so i would suggest you create a new model loader, which is an exact copy of the old one and then make your changes. You might not even have to recompile irrlicht to get it to work as you could just use the model loader in your code rather than smgr->loadMesh.
I guess this would have to be done for every model format you wanted to handle but i think the changes would be pretty minimal.
First job, study the model loader code for your format of choice
Are you absolutely positive there is no way? Accessing meshes is one of the fundamental services a graphic engine should provide.
As I have been told, engines have a few different aproaches to access the data. These buffers should be for rendering, I've been told that often scene managers offer another aproach convenient for developers.
Could it be?