1. Skinning for OpenGL

Hi,

I am trying to implement a dae animation loader for openGL in C++ (for 3d games). My model is rigged in maya and each joint has a nurb binded to it (so I animate the nurbs which in turn affect the joints and the vertices associated with each joint).

The problem is, when i used the skinning equation provided, I get (wildly) incorrect values for my vertices. So i think i might have mis-intepreted the equation in the collada documentation.

SUM OF [vertex * BSM * IBMi * JMi *JW] for no. of joints connected to vertex
-Should i take vertex as ( x, y, z, 1) meaning the outV i get will be in terms of (x,y,z,1) or as a 4x4 {{x,0,0,0}{0,y,0,0}{0,0,z,0}{0,0,0,1}}?
-BSM is from the <bind_shape_matrix> tag and is the same for all vertices right?
-IBMi is from a 16 by no. of joints array provided in the dae file right? eg. this line in my IBM array
Code :
`0.000000 0.999916 -0.012986 -1.767436 -0.000000 0.012986 0.999916 0.020117 1.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000`
-for JMi, I multiplied the transformation matrices from the root to the current node for that frame. eg. if my heirachy is J1->split to J2 + J3->J4. the JMi for J4 should be J1*J3*J4? and for each J in the heirachy, I multiply the 4x4 matrices in order of translate* rotate_x * rotate_y *rotate_z, is this right or did i get the order wrong? Are there any other matices that I need to multiply by like pivot or something?
my rotate and translate values come from eg.
Code :
```<float_array id="nurbsCircle9-translate-animation-outputY-array" count="8">
0.000000 -0.080822 0.034746 -0.092027 -0.092027 -0.063086 -0.034146 0.001305</float_array>```
where (in this case) each value represents the translation in the Y axis for each key frame.
-JW is single float value for each vertex taken from the weights (using <v> and <vcount> tags, im pretty sure i got this part right)

oh and, i intepreted the 16 value float arrays as:
Code :
```matrix[4][4] = {{1,2,3,4},
{5,6,7,8},
{9,10,11,12},
{13,14,15,16}};```

Also, do i use the same formula to calculate the normals? And what do "split per-vertex Normals" and "bake transformations" do (they are options when i export in maya)?

Sorry, I'm quite new to collada and animation, so forgive me if the questions seem like common sense to you. Attached is my dae file for reference.

2. Re: Skinning for OpenGL

Originally Posted by blizzardtweaker
(so I animate the nurbs which in turn affect the joints and the vertices associated with each joint).
You may want to simply your test case so that you can verify NURBS evaluation separately from joint transformations.
Originally Posted by blizzardtweaker
SUM OF [vertex * BSM * IBMi * JMi *JW] for no. of joints connected to vertex
-Should i take vertex as ( x, y, z, 1) meaning the outV i get will be in terms of (x,y,z,1) or as a 4x4 {{x,0,0,0}{0,y,0,0}{0,0,z,0}{0,0,0,1}}?
You can do that as the general case and/or optimize the math for 3x4 transforms or other special cases in your implementation.
Originally Posted by blizzardtweaker
-BSM is from the <bind_shape_matrix> tag and is the same for all vertices right?
Yes for all vertices that are in the base mesh for that skin (see <skin source=""> attribute).
Originally Posted by blizzardtweaker
-IBMi is from a 16 by no. of joints array provided in the dae file right? eg. this line in my IBM array
Code :
`0.000000 0.999916 -0.012986 -1.767436 -0.000000 0.012986 0.999916 0.020117 1.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000`
IBMi is from the <joints><input semantic="INV_BIND_MATRIX"> values yes.
Originally Posted by blizzardtweaker
-for JMi, I multiplied the transformation matrices from the root to the current node for that frame. eg. if my hierarchy is J1->split to J2 + J3->J4. the JMi for J4 should be J1*J3*J4? and for each J in the hierarchy,
That sounds right and remember that COLLADA uses column-major order and post-multiplication.
Originally Posted by blizzardtweaker
I multiply the 4x4 matrices in order of translate* rotate_x * rotate_y *rotate_z, is this right or did i get the order wrong? Are there any other matrices that I need to multiply by like pivot or something?
You need to compose your <node> transformation in the order they are specified without ignoring any of them. Since COLLADA supports an arbitrary transform stack this information may not be consistent from node to node. You will probably normalize the transform when you import the information into your implementation and work off of your own representation internally.
Originally Posted by blizzardtweaker
-JW is single float value for each vertex taken from the weights (using <v> and <vcount> tags, I'm pretty sure i got this part right)
Yes. Don't forget to normalize the weights before using them.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•