## opensg-users

 [Opensg-users] Binding matrix From: cristupidmail - 2013-09-26 08:49:15 Attachments: Message as HTML Hi, I'm a really newbie to OpenSG! Could someone explain to me what the binding matrix does in the testSkinnedGeometry example? I've read that it's used to bind a joint and a vertex or something, but I need to understand it as well as possibile and this is not enough! Thank you in advance. Cristina.
 Re: [Opensg-users] Binding matrix From: Carsten Neumann - 2013-09-26 22:13:47 Hello, On 09/26/2013 03:48 AM, cristupidmail wrote: > I'm a really newbie to OpenSG! > Could someone explain to me what the binding matrix does in the > testSkinnedGeometry example? > I've read that it's used to bind a joint and a vertex or something, but > I need to understand it as well as possibile and this is not enough! the binding matrix for each bone is the inverse of the bone's transformation when it was attached (or bound) to the mesh. This is needed because when the bone has the exact same transformation as at binding time you don't want vertex positions to be affected, i.e. the transformation matrix applied to a vertex should be the identity. When the bone is moved away from the binding transformation you want the vertices affected by the difference between the bone's current transformation and its transformation at binding time, which you get by multiplying with the binding matrix (= inverse of transformation at binding time). Cheers, Carsten
 Re: [Opensg-users] Binding matrix From: cristupidmail - 2013-09-30 07:21:40 Attachments: Message as HTML Hi, 2013/9/27 Carsten Neumann > Hello, > i.e. the transformation matrix applied to a vertex should be the > identity. When > the bone is moved away from the binding transformation you want the > vertices affected by the difference between the bone's current > transformation and its transformation at binding time, which you get by > multiplying with the binding matrix (= inverse of transformation at > binding time). > > Cheers, > Carsten > Ok, the rest position of the vertex V, for example, is clear (pos_V[0]). Instead if I want to know the position of the vertex V in a certain time "1" (not binding time), which operation does OpenSG apply? Something like: pos_V[1] = mat_joint[1] * matBind ? Thanks again!
 Re: [Opensg-users] Binding matrix From: Carsten Neumann - 2013-10-02 22:05:22 On 09/30/2013 02:21 AM, cristupidmail wrote: > Ok, the rest position of the vertex V, for example, is clear (pos_V[0]). > Instead if I want to know the position of the vertex V in a certain time > "1" (not binding time), which operation does OpenSG apply? > Something like: pos_V[1] = mat_joint[1] * matBind ? not exactly. The joint matrices are not indexed by time, but by joint index (a samll number uniquely identifying the joint within the skeleton). Every vertex has a number (usually <= 4) of joints that influence it and as many weights that determine how strong the effect of a joint on the vertex is [1]: mat4x4 matJoints[N]; uint4 jointIdx; float4 jointWeight; float4 inPos; // vertex position in the mesh float4 outPos = (0, 0, 0, 0); for(i=0; i < 4; ++i) { outPos += jointWeight[i] * (matJoints[jointIdx[i]] * inPos); } This assumes the jointWeights have been properly normalized so that they add up to 1 - otherwise you need to divide by the sum of the weights to compensate. The matrices in matJoints are themselves computed by multiplying all joint matrices up to the root joint and then multiplying by the joint's bind matrix. So assuming joint i has parents joint a and joint b: matJoints[i] = joint[a].matrix * joint[b].matrix * joint[i].matrix * joint[i].bindMatrix; Hope it helps, Carsten [1] see the GLSL code in Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp [2] see Source/System/Dynamics/Skeleton/OSGSkeletonJoint.cpp:jointUpdateEnter()
 Re: [Opensg-users] Binding matrix From: cristupidmail - 2013-10-03 08:32:00 Attachments: Message as HTML You're right, I didn't explain it well.. I know that OpenSG doesn't use time for indexing.. sorry! :) However now it's clear! Thank you so much!! Cheers, Cristina 2013/10/3 Carsten Neumann > On 09/30/2013 02:21 AM, cristupidmail wrote: > > Ok, the rest position of the vertex V, for example, is clear (pos_V[0]). > > Instead if I want to know the position of the vertex V in a certain time > > "1" (not binding time), which operation does OpenSG apply? > > Something like: pos_V[1] = mat_joint[1] * matBind ? > > not exactly. The joint matrices are not indexed by time, but by joint > index (a samll number uniquely identifying the joint within the > skeleton). Every vertex has a number (usually <= 4) of joints that > influence it and as many weights that determine how strong the effect of > a joint on the vertex is [1]: > > mat4x4 matJoints[N]; > uint4 jointIdx; > float4 jointWeight; > > float4 inPos; // vertex position in the mesh > float4 outPos = (0, 0, 0, 0); > > for(i=0; i < 4; ++i) > { > outPos += jointWeight[i] * (matJoints[jointIdx[i]] * inPos); > } > > This assumes the jointWeights have been properly normalized so that they > add up to 1 - otherwise you need to divide by the sum of the weights to > compensate. > The matrices in matJoints are themselves computed by multiplying all > joint matrices up to the root joint and then multiplying by the joint's > bind matrix. So assuming joint i has parents joint a and joint b: > > matJoints[i] = joint[a].matrix * joint[b].matrix * > joint[i].matrix * joint[i].bindMatrix; > > Hope it helps, > Carsten > > [1] see the GLSL code in > Source/System/Dynamics/Skeleton/OSGGPUSkinningAlgorithm.cpp > [2] see > Source/System/Dynamics/Skeleton/OSGSkeletonJoint.cpp:jointUpdateEnter() > > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk > _______________________________________________ > Opensg-users mailing list > Opensg-users@... > https://lists.sourceforge.net/lists/listinfo/opensg-users >