Modelview Matrix to vector3D or screen co-ordinates
Modelview Matrix to vector3D or screen co-ordinates
Hi,
I have a modelview matrix which looks something like
- m0[0] m0[1] ... m0[15]
The corresponding values for the same are
- -0.215125 -0.906283 -0.363831 0.000000 -0.822941 0.127188 0.421722 0.000000 0.361637 -0.419996 0.832359 0.000000 -5.188786 -106.603622 -1713.731812 1.000000
I have to animate my MD2 model on screen according to these values.
Can anybody suggest how I an transform the modelview matrix into vector3D array for rendering on the screen.
I need this for my academic project.
Please help.
Thanks and Regards
I have a modelview matrix which looks something like
- m0[0] m0[1] ... m0[15]
The corresponding values for the same are
- -0.215125 -0.906283 -0.363831 0.000000 -0.822941 0.127188 0.421722 0.000000 0.361637 -0.419996 0.832359 0.000000 -5.188786 -106.603622 -1713.731812 1.000000
I have to animate my MD2 model on screen according to these values.
Can anybody suggest how I an transform the modelview matrix into vector3D array for rendering on the screen.
I need this for my academic project.
Please help.
Thanks and Regards
Well the model view matrix doesn't transform into the on-screen coordinates... you need a projection matrix for that.
the model view matrix just transforms where in the 3D world the camera is, i believe.
but anyway, you just multiply the matrix with each of the vertices in your model to make the matrix affect the model.
the model view matrix just transforms where in the 3D world the camera is, i believe.
but anyway, you just multiply the matrix with each of the vertices in your model to make the matrix affect the model.
Why do you want to do this with irrlicht? Irrlicht does it all for you anyway, so there must be some reason you want to do it yourself right? Understanding your reason may help us give you a good response.
To figure out how to do it you'll probably have to look at the relevant classes such as IAnimatedMeshSceneNode, IMeshBuffer, CMatrix etc. to see how you can get access to a node's mesh and vertices and then see how they can be multiplied by a matrix to give you the transformed position.
To figure out how to do it you'll probably have to look at the relevant classes such as IAnimatedMeshSceneNode, IMeshBuffer, CMatrix etc. to see how you can get access to a node's mesh and vertices and then see how they can be multiplied by a matrix to give you the transformed position.
well I am working on a project in which actual user movements are recorded by a webcam and stored in a file.These movements (i.e. the ones recorded by the webcam) are stored in the recorded file in the form of model view matrix.
Now my aim is to render an animation (skeletal animation) on screen corresponding to these captured points.But I am not able to understand how I can do that!!
My scond problem is about skeletal animation.Unfortunately I coud not find a tutorial or good example which can give me an idea of skeletal animation
Please help me
Now my aim is to render an animation (skeletal animation) on screen corresponding to these captured points.But I am not able to understand how I can do that!!
My scond problem is about skeletal animation.Unfortunately I coud not find a tutorial or good example which can give me an idea of skeletal animation
Please help me
I see, is it some kinda of motion-capture you're doing? Using a webcam to get positions of objects in the real-world and recording their movements and then recreating them on-screen?
I'd ignore the skeletal animation bit for now and just find out how to apply your matrices to points to get them moving on the screen.
Basically you just take the matrices you've recorded and apply them to the vertices of your model, just get it working on a simple cube model first. Get the mesh from the model and then iterate through the vertices of the mesh and multiply them by the matrix.
I'd ignore the skeletal animation bit for now and just find out how to apply your matrices to points to get them moving on the screen.
Basically you just take the matrices you've recorded and apply them to the vertices of your model, just get it working on a simple cube model first. Get the mesh from the model and then iterate through the vertices of the mesh and multiply them by the matrix.
Can you explain it to me giving a practical example??Basically you just take the matrices you've recorded and apply them to the vertices of your model, just get it working on a simple cube model first. Get the mesh from the model and then iterate through the vertices of the mesh and multiply them by the matrix.
Skeletal animation is certainly the way you want to go with this, i'm just saying ignore that for the moment and just get the process of applying a matrix to an object to get that moving before you go into the skeletal animation which will be basically the same but applying matrices to multiple objects.
I would imagine using an md2 model (morphing animation) would be much harder because you'd have to know which vertices were part of, say, the hand or head etc. to be able to apply your specific matrices to them. The skeletal animation models take care of this for you because you just apply the matrix to the bone/joint and that in turn affects the necessary vertices.
Ok so i guess as that's what we're aiming for you don't want to affect each individual vertex of a cube, just affect the cube itself with your matrix.
So basically you've got setPosition and setRotation which you can do on a node, so you need to get those informations out of your matrix. To make this easier copy your matrix info into a CMatrix then you can do getRotationDegrees to get a rotation vector to pass to node->setRotation() and getTranslation to get a position vector to pass to node->setPosition().
Capice? See if you can get that working.
EDIT: creating a CMatrix from your matrix data... you may be able to use This;
CMatrix m;
m.setM(pointer_to_your_matrix_data);
That is, if your matrix is the same major as irrlicht's, if not then you can probably use the [] access method.
I would imagine using an md2 model (morphing animation) would be much harder because you'd have to know which vertices were part of, say, the hand or head etc. to be able to apply your specific matrices to them. The skeletal animation models take care of this for you because you just apply the matrix to the bone/joint and that in turn affects the necessary vertices.
Ok so i guess as that's what we're aiming for you don't want to affect each individual vertex of a cube, just affect the cube itself with your matrix.
So basically you've got setPosition and setRotation which you can do on a node, so you need to get those informations out of your matrix. To make this easier copy your matrix info into a CMatrix then you can do getRotationDegrees to get a rotation vector to pass to node->setRotation() and getTranslation to get a position vector to pass to node->setPosition().
Capice? See if you can get that working.
EDIT: creating a CMatrix from your matrix data... you may be able to use This;
CMatrix m;
m.setM(pointer_to_your_matrix_data);
That is, if your matrix is the same major as irrlicht's, if not then you can probably use the [] access method.
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
seems to be how Irrlicht does it, just before the render.
for example, in Irr, they fake the world projection this way:
case ETS_WORLD:
{
// OpenGL only has a model matrix, view and world is not existent. so lets fake these two.
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf((Matrices[ETS_VIEW] * Matrices[ETS_WORLD]).pointer());
// we have to update the clip planes to the latest view matrix
for (u32 i=0; i<MaxUserClipPlanes; ++i)
if (UserClipPlaneEnabled)
uploadClipPlane(i);
}
break;
I'd guess the model matrix is what you are looking for, no?
seems to be how Irrlicht does it, just before the render.
for example, in Irr, they fake the world projection this way:
case ETS_WORLD:
{
// OpenGL only has a model matrix, view and world is not existent. so lets fake these two.
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf((Matrices[ETS_VIEW] * Matrices[ETS_WORLD]).pointer());
// we have to update the clip planes to the latest view matrix
for (u32 i=0; i<MaxUserClipPlanes; ++i)
if (UserClipPlaneEnabled)
uploadClipPlane(i);
}
break;
I'd guess the model matrix is what you are looking for, no?
Hi Guys,
I know this is a diversion from the topic in this post, but I thought of asking it here as this is the only post I am getting replies at
Please check my query at : http://irrlicht.sourceforge.net/phpBB2/ ... 4&start=45
Please let me know if anyone knows about such a problem and can help me out!!
Regarding the modelview matrix..I am giving it a try as per our discussions.Will let you know the results soon.
Thanks and Regards
I know this is a diversion from the topic in this post, but I thought of asking it here as this is the only post I am getting replies at
Please check my query at : http://irrlicht.sourceforge.net/phpBB2/ ... 4&start=45
Please let me know if anyone knows about such a problem and can help me out!!
Regarding the modelview matrix..I am giving it a try as per our discussions.Will let you know the results soon.
Thanks and Regards