Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualkgs

Posted 18 November 2013 - 03:25 AM

Sorry for bother you again, I met a problem when I add rotation matrix to my skin.

This is my file shows the translation,rotation and scale data:

 

Time:0 Trans:22.721792 0.512012 -0.000000 Qart:1.000000 -0.000000 -0.000000 1.570796 Scale:1.000000 1.000000 1.000000
Time:1 Trans:0.092348 23.141449 -0.000000 Qart:-0.577350 -0.577350 0.577350 4.188790 Scale:1.000000 1.000000 1.000000
Time:2 Trans:-22.537085 0.512007 -0.000000 Qart:0.000000 -0.707107 0.707107 3.141593 Scale:1.000000 1.000000 1.000000
Time:3 Trans:0.092356 -22.117428 -0.000000 Qart:-0.577350 0.577350 -0.577350 4.188790 Scale:1.000000 1.000000 1.000000
 
And it's a simple animation to a bone, this animation is a bone around z-axis rotate 90 degree, 180 degree, 270 degree and 360 degree
 
I read the data like this
mYHMMesh.boneInfo.yhmBone[m].frame[n] contains transform data above
for (int i = 0; i < mYHMMesh.boneInfo.BoneCount; i++)
{
     for (int j = 0; j < 120; j++)
     {
	  float4x4 cubeTrans = translation(mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.z);
	  float4x4 cubeRot = rotationArbitrary(float3(mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.z), mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.w / 3.1415926 * 180);
	  float4x4 cubeScale = scale(mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.z);
	  mBoneTransforms[i][j] = mul(mul(cubeScale, cubeRot), cubeTrans);
          //mBoneTransforms[i][j] = mul(cubeScale, cubeTrans);
          //If I use only scale and trans data, I would see the animation is on the right way except for rotation animation
     }
     //Here I calculate the offset matrix
     XMFLOAT4X4 tempOffset = floatToXMFLOAT(mBoneTransforms[i][0]);
     XMStoreFloat4x4(&tempOffset, XMMatrixInverse(NULL, XMLoadFloat4x4(&tempOffset)));
     mBoneOffset[i] = XMFLOATTofloat4x4(tempOffset);
}

and then I draw it with the matrix mul(mBoneOffset[i], mBoneTransform[i][frameCount % 120])

Is there any thing wrong?The some vertex didn't follow the bone.

What I saw is this

3tb_131116161317ac1w512293.png


#4kgs

Posted 16 November 2013 - 02:21 AM

Sorry for bother you again, I met a problem when I add rotation matrix to my skin.

This is my file shows the translation,rotation and scale data:

 

Time:0 Trans:22.721792 0.512012 -0.000000 Qart:1.000000 -0.000000 -0.000000 1.570796 Scale:1.000000 1.000000 1.000000
Time:1 Trans:0.092348 23.141449 -0.000000 Qart:-0.577350 -0.577350 0.577350 4.188790 Scale:1.000000 1.000000 1.000000
Time:2 Trans:-22.537085 0.512007 -0.000000 Qart:0.000000 -0.707107 0.707107 3.141593 Scale:1.000000 1.000000 1.000000
Time:3 Trans:0.092356 -22.117428 -0.000000 Qart:-0.577350 0.577350 -0.577350 4.188790 Scale:1.000000 1.000000 1.000000
 
And it's a simple animation to a bone, this animation is a bone around z-axis rotate 90 degree, 180 degree, 270 degree and 360 degree
 
I read the data like this
mYHMMesh.boneInfo.yhmBone[m].frame[n] contains transform data above
for (int i = 0; i < mYHMMesh.boneInfo.BoneCount; i++)
{
     for (int j = 0; j < 120; j++)
     {
	  float4x4 cubeTrans = translation(mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.z);
	  float4x4 cubeRot = rotationArbitrary(float3(mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.z), mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.w / 3.1415926 * 180);
	  float4x4 cubeScale = scale(mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.z);
	  mBoneTransforms[i][j] = mul(mul(cubeScale, cubeRot), cubeTrans);
          //mBoneTransforms[i][j] = mul(cubeScale, cubeTrans);
          //If I use only scale and trans data, I would see the animation is on the right way except for rotation animation
     }
     //Here I calculate the offset matrix
     XMFLOAT4X4 tempOffset = floatToXMFLOAT(mBoneTransforms[i][0]);
     XMStoreFloat4x4(&tempOffset, XMMatrixInverse(NULL, XMLoadFloat4x4(&tempOffset)));
     mBoneOffset[i] = XMFLOATTofloat4x4(tempOffset);
}

and then I draw it with the matrix mul(mBoneOffset[i], mBoneTransform[i][frameCount % 120])

Is there any thing wrong?

What I saw is this

3tb_131116161317ac1w512293.png


#3kgs

Posted 16 November 2013 - 02:16 AM

Sorry for bother you again, I met a problem when I add rotation matrix to my skin.

This is my file shows the translation,rotation and scale data:

 

 

Time:0 Trans:22.721792 0.512012 -0.000000 Qart:1.000000 -0.000000 -0.000000 1.570796 Scale:1.000000 1.000000 1.000000
Time:1 Trans:0.092348 23.141449 -0.000000 Qart:-0.577350 -0.577350 0.577350 4.188790 Scale:1.000000 1.000000 1.000000
Time:2 Trans:-22.537085 0.512007 -0.000000 Qart:0.000000 -0.707107 0.707107 3.141593 Scale:1.000000 1.000000 1.000000
Time:3 Trans:0.092356 -22.117428 -0.000000 Qart:-0.577350 0.577350 -0.577350 4.188790 Scale:1.000000 1.000000 1.000000
 
And it's a simple animation to a bone, this animation is a bone around z-axis rotate 90 degree, 180 degree, 270 degree and 360 degree
 
I read the data like this
mYHMMesh.boneInfo.yhmBone[m].frame[n] contains transform data above
for (int i = 0; i < mYHMMesh.boneInfo.BoneCount; i++)
{
     for (int j = 0; j < 120; j++)
     {
	  float4x4 cubeTrans = translation(mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.z);
	  float4x4 cubeRot = rotationArbitrary(float3(mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.z), mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.w / 3.1415926 * 180);
	  float4x4 cubeScale = scale(mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.z);
	  mBoneTransforms[i][j] = mul(mul(cubeScale, cubeRot), cubeTrans);
     }
     //Here I calculate the offset matrix
     XMFLOAT4X4 tempOffset = floatToXMFLOAT(mBoneTransforms[i][0]);
     XMStoreFloat4x4(&tempOffset, XMMatrixInverse(NULL, XMLoadFloat4x4(&tempOffset)));
     mBoneOffset[i] = XMFLOATTofloat4x4(tempOffset);
}

and then I draw it with the matrix mul(mBoneOffset[i], mBoneTransform[i][frameCount % 120])

Is there any thing wrong?

What I saw is this

3tb_131116161317ac1w512293.png


#2kgs

Posted 16 November 2013 - 02:15 AM

Sorry for bother you again, I met a problem when I add rotation matrix to my skin.

This is my file shows the translation,rotation and scale data:

 

 

Time:0 Trans:22.721792 0.512012 -0.000000 Qart:1.000000 -0.000000 -0.000000 1.570796 Scale:1.000000 1.000000 1.000000
Time:1 Trans:0.092348 23.141449 -0.000000 Qart:-0.577350 -0.577350 0.577350 4.188790 Scale:1.000000 1.000000 1.000000
Time:2 Trans:-22.537085 0.512007 -0.000000 Qart:0.000000 -0.707107 0.707107 3.141593 Scale:1.000000 1.000000 1.000000
Time:3 Trans:0.092356 -22.117428 -0.000000 Qart:-0.577350 0.577350 -0.577350 4.188790 Scale:1.000000 1.000000 1.000000
 
And it's a simple animation to a bone, this animation is a bone around z-axis rotate 90 degree, 180 degree, 270 degree and 360 degree
 
I read the data like this

for (int i = 0; i < mYHMMesh.boneInfo.BoneCount; i++)
{
     for (int j = 0; j < 120; j++)
     {
	  float4x4 cubeTrans = translation(mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.z);
	  float4x4 cubeRot = rotationArbitrary(float3(mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.z), mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.w / 3.1415926 * 180);
	  float4x4 cubeScale = scale(mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.z);
	  mBoneTransforms[i][j] = mul(mul(cubeScale, cubeRot), cubeTrans);
     }
     //Here I calculate the offset matrix
     XMFLOAT4X4 tempOffset = floatToXMFLOAT(mBoneTransforms[i][0]);
     XMStoreFloat4x4(&tempOffset, XMMatrixInverse(NULL, XMLoadFloat4x4(&tempOffset)));
     mBoneOffset[i] = XMFLOATTofloat4x4(tempOffset);
}

and then I draw it with the matrix mul(mBoneOffset[i], mBoneTransform[i][frameCount % 120])

Is there any thing wrong?

What I saw is this

3tb_131116161317ac1w512293.png


#1kgs

Posted 16 November 2013 - 02:14 AM

Sorry for bother you again, I met a problem when I add rotation matrix to my skin.

This is my file shows the translation,rotation and scale data:

 

 

Time:0 Trans:22.721792 0.512012 -0.000000 Qart:1.000000 -0.000000 -0.000000 1.570796 Scale:1.000000 1.000000 1.000000
Time:1 Trans:0.092348 23.141449 -0.000000 Qart:-0.577350 -0.577350 0.577350 4.188790 Scale:1.000000 1.000000 1.000000
Time:2 Trans:-22.537085 0.512007 -0.000000 Qart:0.000000 -0.707107 0.707107 3.141593 Scale:1.000000 1.000000 1.000000
Time:3 Trans:0.092356 -22.117428 -0.000000 Qart:-0.577350 0.577350 -0.577350 4.188790 Scale:1.000000 1.000000 1.000000
 
And it's a simple animation to a bone, this animation is a bone around z-axis rotate 90 degree, 180 degree, 270 degree and 360 degree
 
I read the data like this

for (int i = 0; i < mYHMMesh.boneInfo.BoneCount; i++)
	{
		for (int j = 0; j < 120; j++)
		{
			float4x4 cubeTrans = translation(mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].trans.z);
			float4x4 cubeRot = rotationArbitrary(float3(mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.z), mYHMMesh.boneInfo.yhmBone[i].frame[j].rot.w / 3.1415926 * 180);
			float4x4 cubeScale = scale(mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.x, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.y, mYHMMesh.boneInfo.yhmBone[i].frame[j].scale.z);
			mBoneTransforms[i][j] = mul(mul(cubeScale, cubeRot), cubeTrans);
		}
//Here I calculate the offset matrix
		XMFLOAT4X4 tempOffset = floatToXMFLOAT(mBoneTransforms[i][0]);
		XMStoreFloat4x4(&tempOffset, XMMatrixInverse(NULL, XMLoadFloat4x4(&tempOffset)));
		mBoneOffset[i] = XMFLOATTofloat4x4(tempOffset);
	}

and then I draw it with the matrix mul(mBoneOffset[i], mBoneTransform[i][frameCount % 120])

Is there any thing wrong?

What I saw is this

3tb_131116161317ac1w512293.png


PARTNERS