Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualTispe

Posted 21 September 2012 - 08:38 AM

OK.... I got things showing up in the debugger now. But guess what, the matrices are incorrect.

pGraphicsDevice->constantTable->SetMatrixArray(pGraphicsDevice->GetDevice(), "FirstTenSkeleton", pPlayers[i]->pRaceSkeleton->pSkeleton, 10);
  D3DXMATRIX FirstBone = pPlayers[i]->pRaceSkeleton->pSkeleton[0];

In VS2010 FirstBone matrix has the following values:
  _11 5.9604645e-008 float
  _12 0.00000000 float
  _13 0.99999994 float
  _14 0.00000000 float
  _21 0.00000000 float
  _22 1.0000000 float
  _23 0.00000000 float
  _24 0.00000000 float
  _31 -0.99999994 float
  _32 0.00000000 float
  _33 5.9604645e-008 float
  _34 0.00000000 float
  _41 0.00000000 float
  _42 0.00000000 float
  _43 0.00000000 float
  _44 1.0000000 float


The Vertex Shader gives Bone0 this value:
Bone0 ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1065353216 ) float16


Row-major or Column major should only swap rows for columns right? So it is not about that here?

Here is the new VS:
// Vertex shader input structure
struct VS_INPUT
{
	float4 Position   : POSITION;
	float2 Texture	: TEXCOORD0;
};

// Vertex shader output structure
struct VS_OUTPUT
{
	float4 Position   : POSITION;
	float2 Texture	: TEXCOORD0;
};

// Global variables
float4x4 World;
float4x4 ViewProj;
sampler2D Tex1 : register(s1);
float4x4 FirstTenSkeleton[10];

// Name: Simple Vertex Shader
// Type: Vertex shader
// Desc: Vertex transformation and texture coord pass-through
//
VS_OUTPUT vs_main( in VS_INPUT In )
{
	VS_OUTPUT Out;					  //create an output vertex
	float4x4 WorldViewProj = mul(World, ViewProj);
float4x4 Bone0 = FirstTenSkeleton[0];
float4x4 Bone1 = FirstTenSkeleton[1];
float4x4 Bone2 = FirstTenSkeleton[2];
float4x4 Bone3 = FirstTenSkeleton[3];
float4x4 Bone4 = FirstTenSkeleton[4];
float4x4 Bone5 = FirstTenSkeleton[5];
float4x4 Bone6 = FirstTenSkeleton[6];
float4x4 Bone7 = FirstTenSkeleton[7];
float4x4 Bone8 = FirstTenSkeleton[8];
float4x4 Bone9 = FirstTenSkeleton[9];
	Out.Position = mul(In.Position, WorldViewProj);  //apply vertex transformation
	Out.Texture  = In.Texture;		  //copy original texcoords

//Remove, just for testing
float4x4 temp1 = Bone0 + Bone1 + Bone2 + Bone3 + Bone4;
float temp2 = temp1[0][0] + temp1[0][1] + temp1[0][2] + temp1[0][3] +
	 temp1[1][0] + temp1[1][1] + temp1[1][2] + temp1[1][3] +
	 temp1[2][0] + temp1[2][1] + temp1[2][2] + temp1[2][3] +
	 temp1[3][0] + temp1[3][1] + temp1[3][2] + temp1[3][3];
	
Out.Texture.x += temp2 * 0.0001;

	return Out;						 //return output vertex
}

#1Tispe

Posted 21 September 2012 - 08:36 AM

OK.... I got things showing up in the debugger now. But guess what, the matrices are incorrect.

pGraphicsDevice->constantTable->SetMatrixArray(pGraphicsDevice->GetDevice(), "FirstTenSkeleton", pPlayers[i]->pRaceSkeleton->pSkeleton, 10);
  D3DXMATRIX FirstBone = pPlayers[i]->pRaceSkeletonDAT->pSkeleton[0];

In VS2010 FirstBone matrix has the following values:
  _11 5.9604645e-008 float
  _12 0.00000000 float
  _13 0.99999994 float
  _14 0.00000000 float
  _21 0.00000000 float
  _22 1.0000000 float
  _23 0.00000000 float
  _24 0.00000000 float
  _31 -0.99999994 float
  _32 0.00000000 float
  _33 5.9604645e-008 float
  _34 0.00000000 float
  _41 0.00000000 float
  _42 0.00000000 float
  _43 0.00000000 float
  _44 1.0000000 float


The Vertex Shader gives Bone0 this value:
Bone0 ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1065353216 ) float16


Row-major or Column major should only swap rows for columns right? So it is not about that here?

Here is the new VS:
// Vertex shader input structure
struct VS_INPUT
{
    float4 Position   : POSITION;
    float2 Texture    : TEXCOORD0;
};

// Vertex shader output structure
struct VS_OUTPUT
{
    float4 Position   : POSITION;
    float2 Texture    : TEXCOORD0;
};

// Global variables
float4x4 World;
float4x4 ViewProj;
sampler2D Tex1 : register(s1);
float4x4 FirstTenSkeleton[10];

// Name: Simple Vertex Shader
// Type: Vertex shader
// Desc: Vertex transformation and texture coord pass-through
//
VS_OUTPUT vs_main( in VS_INPUT In )
{
    VS_OUTPUT Out;					  //create an output vertex
    float4x4 WorldViewProj = mul(World, ViewProj);
float4x4 Bone0 = FirstTenSkeleton[0];
float4x4 Bone1 = FirstTenSkeleton[1];
float4x4 Bone2 = FirstTenSkeleton[2];
float4x4 Bone3 = FirstTenSkeleton[3];
float4x4 Bone4 = FirstTenSkeleton[4];
float4x4 Bone5 = FirstTenSkeleton[5];
float4x4 Bone6 = FirstTenSkeleton[6];
float4x4 Bone7 = FirstTenSkeleton[7];
float4x4 Bone8 = FirstTenSkeleton[8];
float4x4 Bone9 = FirstTenSkeleton[9];
    Out.Position = mul(In.Position, WorldViewProj);  //apply vertex transformation
    Out.Texture  = In.Texture;		  //copy original texcoords

//Remove, just for testing
float4x4 temp1 = Bone0 + Bone1 + Bone2 + Bone3 + Bone4;
float temp2 = temp1[0][0] + temp1[0][1] + temp1[0][2] + temp1[0][3] +
	 temp1[1][0] + temp1[1][1] + temp1[1][2] + temp1[1][3] +
	 temp1[2][0] + temp1[2][1] + temp1[2][2] + temp1[2][3] + 
	 temp1[3][0] + temp1[3][1] + temp1[3][2] + temp1[3][3];
	 
Out.Texture.x += temp2 * 0.0001;

    return Out;						 //return output vertex
}

PARTNERS