Jump to content

  • Log In with Google      Sign In   
  • Create Account


Endemoniada

Member Since 01 Jul 2003
Offline Last Active Sep 14 2014 11:51 AM

Posts I've Made

In Topic: 2D Geometry Problem

14 September 2014 - 11:52 AM

Thanks guys,

 

I'm using this for actual geometry, not hulls.

 

The intersection method is working, It gave me the idea to do something similar using the boolean operator in 3ds, it has the same effect.

 

Thanks again.


In Topic: FBX and Skinned Animation

12 August 2014 - 04:29 PM

Hi Buckeye,

 

You pretty much solved my problem with your first paragraph. I was using the wrong axis for the local translation value. I also feel like I finally have a pretty good understanding of what it means to go from one bone space to another.

 

My goal was to setup a simple bone chain by hand so I could learn the mechanics of creating the offset (inverse bind) matrix as well as interpolating bones between poses to move the model vertices; and also to know exactly what data I should be getting from my FXB converter which brings me to this...

 

I know you don't use FBX but please bear with me. I can't figure out how to get the local transforms for each bone in the bind pose, or if they are even accessable. I can get the inverse world transforms of each bone and I already know the hiearchy. Can I do my own math to get the local bone transforms so I can compute the offset matrices myself ? If I can do that then I think I am all set.

 

I'm sorry if I got you a little annoyed with reusing variables and stuff, I will now be much more explicit in my code. It's like you said, it's better if I help others help me.

 

Thanks a lot man.


In Topic: FBX SDK Normal parsing problem

12 August 2014 - 03:57 PM

eee, were you able to figure it out ?

 


In Topic: Y-Axis Rotation from Matrix

08 August 2014 - 12:17 AM

Hey guys,

 

I didn't think it was a good thing but figured I'd give it a shot. I'm trying to test something that's not working and think it might help.

 

A typical example is this:

 

 
D3DXMATRIX R, T, M;
 
D3DXMatrixTranslation(&T, 2.0f, 0.0f, 0.0f);
D3DXMatrixRotationY(&R, -D3DX_PI*0.5f);
M=R*T;
M=M*SomeOtherMatrix;
D3DXMatrixInverse(&M, NULL, &M);
 
float r=GetYRotation(&M); // the helper I want to make
 
// if it worked properly it would do this:
D3DXMatrixRotationY(&R, D3DX_PI*0.5f);
float r=GetYRotation(&M);
// r would equel pi*0.5
 

 

That's all I would be using it for.

 

Thanks.


In Topic: FBX and Skinned Animation

07 August 2014 - 08:36 PM

Hi Buckeye,

 

I'm really at a loss. Either I am doing something fundamentally wrong, or the algorithm doesn't work. I did what you said and made everything clear, I also put everything in a single function that has no dependencies (except D3DX).

 

It should calculate the correct final (skinning) matrices. As a test I multiply the two blue points (left half of diagram) with joint_c.final, they should result in the two blue points on the right half of the diagram but they don't.

 

 

bones_20_zpsab3e3a97.jpg

 

Here is the code:

 
struct Joint // or Bone or Frame
{
 D3DXMATRIX offset; // pre-computed offset (or inverse bind)
 D3DXMATRIX local; // transforms to parent's space (in bind pose)
 D3DXMATRIX anim; // normally in SRT struct but here for simplicity
 D3DXMATRIX combined; // anim*local * parent.anim*parent.local * ...(up to root)
 D3DXMATRIX final; // final or skinning matrix
};
 
void Test()
{
 D3DXMATRIX R,T,temp;

 Joint joint_a; // root
 Joint joint_b; // child of joint_a
 Joint joint_c; // child of joint_b

 // local transforms

 D3DXMatrixIdentity(&joint_a.local);

 D3DXMatrixRotationY(&R, -D3DX_PI*0.5f);
 D3DXMatrixTranslation(&T, 2.0f, 0.0f, 0.0f);
 joint_b.local=R*T;

 D3DXMatrixTranslation(&T, 0.0f, 0.0f, 2.0f);
 joint_c.local=T;

 // offset (inverse bind)

 temp=joint_a.local;
 D3DXMatrixInverse(&joint_a.offset, NULL, &temp);

 temp=joint_b.local*joint_a.local;
 D3DXMatrixInverse(&joint_b.offset, NULL, &temp);

 temp=joint_c.local*joint_b.local*joint_a.local;
 D3DXMatrixInverse(&joint_c.offset, NULL, &temp);

 // joint animation

 D3DXMatrixIdentity(&joint_a.anim);
 D3DXMatrixIdentity(&joint_b.anim);

 // we only rotate (animate) joint_c with a 90deg rotation
 D3DXMatrixRotationY(&joint_c.anim, D3DX_PI*0.5f);

 // compute combined matrices

 joint_a.combined=joint_a.anim*joint_a.local;

 joint_b.combined=(joint_b.anim*joint_b.local)*joint_a.combined;

 joint_c.combined=(joint_c.anim*joint_c.local)*joint_b.combined;

 // final matrices

 joint_a.final=joint_a.offset*joint_a.combined;
 joint_b.final=joint_b.offset*joint_b.combined;
 joint_c.final=joint_c.offset*joint_c.combined;

 // transform (morph) some vertices

 D3DXVECTOR3 va,vb;

 va.x=2.0f; va.y=0.0f; va.z=2.0f;
 vb.x=2.0f; vb.y=0.0f; vb.z=4.0f;

 D3DXVec3TransformCoord(&va, &va, &joint_c.final);
 D3DXVec3TransformCoord(&vb, &vb, &joint_c.final);
}
 

It's only about 20 lines of code with basic matrix math. I really don't know what I am doing wrong. If you don't want to go through my code maybe you can just look at the diagram and write some code the way you would do it.

 

I don't know what else to try at this point.

 

Thanks a lot.


PARTNERS