PDA

View Full Version : 3D Skeletal Animation Help



noahn567
11-03-2014, 09:00 PM
Hello, i've recently gotten into creating my very own 3D game engine and i've gotten to the point where i would like to apply animations to my 3D meshes. I've got the ability to create a 3d model (obj format) and place it in 3d space at a location, with a certain rotation (using Quaternions) and a certain size. So i know how to rotate the whole mesh, but i want to only rotate certain groups of vertices around a point. I've rigged some bones onto a model and exported. I have the initial rotations for the bones, and the vertex weights on the mesh.

Questions:
1. How do i apply a transformation matrix to only a part of a mesh?
2. Also, how do i incorporate vertex weights to make the rotation more or less?
3. Do i need to create arrays of vertices for each bone? To then apply different transformation matrices to each different array of vertices?
4. If i'm right with number 3, how would the vertex weight effect the amount of rotation?

Would be great if you guys could help me get all these questions answered, but if you can only help me with one go ahead! Its much appreciated. :D

Also if you have any questions, ask away!

DragonForce99
11-04-2014, 12:56 AM
hello

take a look
https://www.opengl.org/wiki/Skeletal_Animation

DragonForce99
11-04-2014, 01:13 AM
all what you need is add some attributes to your vertex

1 vertex Bonesindex(int array)
2 vertex weight(float array) ranged between [0-1]

you have array of matrix (bones) so multiply bone's matrix in vertex position

newvertex = Bonesindex[0].matrix * orginalvertex * weight[0];
newnormal = Bonesindex[0].matrix * orginalnormal * weight[0];

newvertex += Bonesindex[1].matrix * orginalvertex * weight[1];
newnormal += Bonesindex[1].matrix * orginalnormal * weight[1];

i can assume that you are apllying your bones in cpu
it's up to you but if you are developing games aplly in gpu such the link abov

another thing:
looks like you are not using vbo (Vertex Buffer Object) that the best way to save your mesh' vertex in your gpu memory and just call the function to draw it
it's thae fastes way to draw your mesh to avoid calling the functions (glVertex(1,1,1);)

i hop this will help you