Hey everyone, having a bit of an issue hoping someone can give me some guidance on.
Currently trying to get the proper vertex position based off of an animated joint. The bind position works fine, but getting it to work during animation it blows up in our faces.
We have joints are being positioned correctly for the bind pose and each animation frame fine and have (What I believe is) all the data stored and ready for use and that is required for this task at hand. I just cant seem to figure out the math.
From what I have read people have said to use an algorithm such as this:
vertex_Pos = (parents_bind_pose * animated_pose) * Inverse_Bind_Pose
however this does not seem to work
Looking forward to any help!
Skinning from joints (Vertex Position/transform)
Page 1 of 18 Replies - 816 Views - Last Post: 19 April 2012 - 03:32 PM
Replies To: Skinning from joints (Vertex Position/transform)
#2
Re: Skinning from joints (Vertex Position/transform)
Posted 17 April 2012 - 03:34 AM
Okay, I'm guessing this is 2D? How does it 'not work' exactly?
#3
Re: Skinning from joints (Vertex Position/transform)
Posted 17 April 2012 - 04:45 AM
it is 3d, and im just getting quiet a bit of strange transformations on the vertexes that should be animating
I have attached a picture, it becomes clear the issue haha. Cause his hands shouldnt grow this give or his legs should bend that way.
I have attached a picture, it becomes clear the issue haha. Cause his hands shouldnt grow this give or his legs should bend that way.
#4
Re: Skinning from joints (Vertex Position/transform)
Posted 17 April 2012 - 10:42 AM
I don't know what to say! LOL!
As you can tell the math is completely wrong, how to correct it code will need to be seen. Also, are you able to record the animation in action by any chance? The timing and progression of how things go wrong offer the very best clues.
Just looking at it I can see that you are getting serious errors in translating the various components of your model.
As you can tell the math is completely wrong, how to correct it code will need to be seen. Also, are you able to record the animation in action by any chance? The timing and progression of how things go wrong offer the very best clues.
Just looking at it I can see that you are getting serious errors in translating the various components of your model.
#5
Re: Skinning from joints (Vertex Position/transform)
Posted 17 April 2012 - 11:15 AM
ButchDean, on 17 April 2012 - 10:42 AM, said:
I don't know what to say! LOL!
That happened! haha. You should of seen the previous transformation issues we got earlier could almost use it as a mutant.... large mutant at that. Any-ways issue at hand (code will look a wee bit sloppy until we know how this works properly then it will be cleaned and optimized of course!)
ArrayList<Joint> joints = skeleton.Joints();
ArrayList<Face> faces = mesh.Faces();
for (Face f : faces)
{
Matrix4f _Vpos = new Matrix4f();
_Vpos.setIdentity();
Joint j = joints.get(f.V1().JI());
_Vpos.mul(j.InvBindMat(), j.AnimMat(), _Vpos);
f.V1().VertA(new Vector3f(f.V1().VertB().x + _Vpos.m03, f.V1().VertB().y +_Vpos.m13, f.V1().VertB().z +_Vpos.m23));
j = joints.get(f.V2().JI());
_Vpos.mul(j.InvBindMat(), j.AnimMat(), _Vpos);
f.V2().VertA(new Vector3f(f.V2().VertB().x + _Vpos.m03, f.V2().VertB().y +_Vpos.m13, f.V2().VertB().z +_Vpos.m23));
j = joints.get(f.V3().JI());
_Vpos.mul(j.InvBindMat(), j.AnimMat(), _Vpos);
f.V3().VertA(new Vector3f(f.V3().VertB().x + _Vpos.m03, f.V3().VertB().y +_Vpos.m13, f.V3().VertB().z +_Vpos.m23));
}
for (Face f : faces)
{
Texture texture = null;
for (Material m: mats)
if (m.getName().equals(f.Mat()))
texture = m.DifText();
GL11.glPushMatrix();
texture.bind();
GL11.glTranslatef(pos.x, pos.y, pos.z);
GL11.glBegin(GL11.GL_TRIANGLES);
GL11.glTexCoord2f(f.V1().U(), f.V1().V());
GL11.glNormal3f(f.V1().Norm().getX(), f.V1().Norm().getY(), f.V1().Norm().getZ());
GL11.glVertex3f(f.V1().VertA().getX(), f.V1().VertA().getY(), f.V1().VertA().getZ());
GL11.glTexCoord2f(f.V2().U(), f.V2().V());
GL11.glNormal3f(f.V2().Norm().getX(), f.V2().Norm().getY(), f.V2().Norm().getZ());
GL11.glVertex3f(f.V2().VertA().getX(), f.V2().VertA().getY(), f.V2().VertA().getZ());
GL11.glTexCoord2f(f.V3().U(), f.V3().V());
GL11.glNormal3f(f.V3().Norm().getX(), f.V3().Norm().getY(), f.V3().Norm().getZ());
GL11.glVertex3f(f.V3().VertA().getX(), f.V3().VertA().getY(), f.V3().VertA().getZ());
GL11.glEnd();
GL11.glPopMatrix();
}
Thats the jist of the render method. What we have at the moment till we can figure out how to properly make this work is a bind pose for each vert and we change it based on the animation. reasoning for that was to keep it one big mesh, do math required first, then do the drawing of all the faces.
Now animations are done through an update method using a coded animator. As the joints are concerned they will animate correctly. Just when we place the mesh on not so much. And at this point and havent had too much help searching google its more bashing buttons and hope it works kind of deal haha or so it feels like.
As for animations they are done through a slerp method. The actual animations are made within a modeling program (Milkshape3d or blender) through an exported scripted by us.
Once again Thanks for the help or any info you can pass on
#6
Re: Skinning from joints (Vertex Position/transform)
Posted 17 April 2012 - 05:47 PM
I can't work it out just by looking at your code. Plus, it clearly isn't correct.
You should be inspecting precisely when things go wrong (hence the request for the movie), as well as observing how they go wrong.
You should be inspecting precisely when things go wrong (hence the request for the movie), as well as observing how they go wrong.
#7
Re: Skinning from joints (Vertex Position/transform)
Posted 18 April 2012 - 04:48 PM
so to be fair for testing purposes we just have it load to the guy doing a funny animation (quickly done to make sure all the joints move properly for when its fixed into the game display)
Here are two videos first one is the one that is screwing up, the second is from milkshape3d which we used to make the animation.... in other words, working correctly
Appreciate any help you can give
Java Engine Not working
Milkshape3d Working correctly
Did a bit of playing around and decided to add the joints to show where they are drawn. here are the videos for thoes (one with just the joints and one with both mesh and joints)
Joints animation
Mesh and Joints
Here are two videos first one is the one that is screwing up, the second is from milkshape3d which we used to make the animation.... in other words, working correctly
Appreciate any help you can give
Java Engine Not working
Milkshape3d Working correctly
Did a bit of playing around and decided to add the joints to show where they are drawn. here are the videos for thoes (one with just the joints and one with both mesh and joints)
Joints animation
Mesh and Joints
This post has been edited by blindstone: 18 April 2012 - 06:12 PM
#8
Re: Skinning from joints (Vertex Position/transform)
Posted 18 April 2012 - 07:18 PM
Not to double post BUT here it is.
I got it working correctly
Was of course a math issue with the multiplying the matrix for the verticies from the animation matrix
so in a sense just in-case anyone else has this issue:
to get the proper vertex position it would be
vertFinal = (JointInverseBind * animationMatrix) * vert.pos;
I got it working correctly
so in a sense just in-case anyone else has this issue:
to get the proper vertex position it would be
vertFinal = (JointInverseBind * animationMatrix) * vert.pos;
#9
Re: Skinning from joints (Vertex Position/transform)
Posted 19 April 2012 - 03:32 PM
Just when I get round to looking at it. Well done!
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|