Skinning for OpenGL


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

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 J1J3J4? 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.

<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 and tags, im pretty sure i got this part right)

oh and, i intepreted the 16 value float arrays as:

matrix[4][4] = {{1,2,3,4},

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. :oops: Attached is my dae file for reference.

Thank you in advance for your time.

You may want to simply your test case so that you can verify NURBS evaluation separately from joint transformations.

You can do that as the general case and/or optimize the math for 3x4 transforms or other special cases in your implementation.

Yes for all vertices that are in the base mesh for that skin (see <skin source=""> attribute).

IBMi is from the <joints><input semantic=“INV_BIND_MATRIX”> values yes.

That sounds right and remember that COLLADA uses column-major order and post-multiplication.

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.

Yes. Don’t forget to normalize the weights before using them.