last day (20 days later) » 

8:06 PM
1
A: Applying weights to matrixes and vertices (bone rotation)

Tom De CaluwéThe problem The cause of what your seeing is illustrated by the drawing in Levans answer. However, to understand what's going on consider what's happening when you execute the code: If the first point vert1 has coordinates (p, 0) the coordinates of vert2 will be (p cos α, p sin α) where α is th...

 
What you described with |cos α/2| is what I mentioned in bullet point 4 in the question, I will try it. Splitting the mesh is not an option, but I've considered having an intermediate "kneecap" type bone to avoid approaching 180°. Before I try slerp, do I send the ending point to the vertex shader or do I multiply it by the matrix on the vertex shader?
 
You can keep the matrix multiplications in the shader, you only need to adjust the weights used to the ones mentioned in the wiki page. Do keep in mind that the slerp technique also has problems at 180°.
 
I can live with force-avoiding 170° and higher. Does it gradually get worse approaching 180° or is it some kind of divide-by-zero because it doesn't know which direction to go to "get from the north pole to the south pole"?
 
For the slerp, it's a divide by zero because the sine function is zero at 0° and 180°. For the renormalizing technique it's a divide by zero because the linear interpolation passes through the origin (you might indeed say it doesn't know how to get from the north to the south pole). To obtain the angle from the rotation matrix, keep in mind that cos α = (tr(M)-1)/2 where tr is the trace function and M is a 3D matrix.
 
Posting code in comments is ineffective. This is geometric slerp on the vertex shader, I'm calling it with gl_Position = Slerp(vert1,vert2,weight) and its still pinching. pastebin.com/vZieSqhU Am I doing it wrong?
the above is modeled after keithmaggio.wordpress.com/2011/02/15/…
 
8:06 PM
The slerp method preserves the distance between the points vert1 and vert2 not the profile of your mesh. So the volume of the mesh does indeed shrink. See also the last comment of my answer.
 
I thought it preserved the distance between the points vert1 and the axis of rotation when its interpolated between vert1 and vert2
 
Yes I'm sorry you're right
What I meant to say is that it preserves the distance between the points from the mesh
 
yes I'm fine with some volume change, but its pinching such that one wall of the mesh almost touches the other as it approaches 180
almost identical if not identical to what it was doing without slerp, which makes me think I'm doing something very wrong in my slerp function
 
Did you use the slerp function from the wiki page?
I'm scanning through the page you posted right now
 
the omega part confused me so I searched for geometric slerp and used the one from the keithmaggio~ link instead
 
8:14 PM
The omega is the angle between the rotation matrices
 
in radians?
 
Depends on your trig functions, I expect so yes
I think for the keithmaggio version your input vectors might need to be normalized
 
changing to float dotp = dot(normalize(p0), normalize(p1)); didn't change anything
cancel that, I changed it to p0=normalize(p0); and p1=normalize(p1); at the start of function
 
Perhaps try the version from wikipedia?
 
still no difference, I will do that now
so I'll have to send the angle to the shader. I'm guessing there's no way to calculate that without the rotation axis.
 
8:20 PM
You can calculate the angle of a matrix M by acos[(M[0][0] + M[1][1] + M[2][2] -1)/2]
 
Would the rightmost column of the rotation matrix be the angle? ah good
 
So if you do that for both and add em together you get the angle
No i'm sorry that's not right
You actually neec to calculate M by multiplying A by the inverse of B where A and B are your bones
 
I miss-phrased mine, I mean the rightmost column be the origin of the rotation
 
You're working with homogenuous coordinates?
 
so definitely "cheaper" to send the angle?
 
8:24 PM
I guess :)
 
cartesian coordinates
ok I'll let you know how it turns out, this might take a while
this has been very helpful
 
alright, no problem
 
8:47 PM
assuming bone_2 represents the radians for the corresponding matrix
in_I_W_O_1.x, in_I_W_O_1.y , in_I_W_O_1.z are matrix index, weight for matrix index, second matrix index
so 1-in_I_W_O_1.y is the second weight
 
You should delete the weights from line 19 and 20
the interpolation is now handled by the slerp function
 
9:02 PM
it does something different now, but its not right still. I'll try a few things
 

  last day (20 days later) »