Jump to content

  • Log In with Google      Sign In   
  • Create Account

jchmack

Member Since 29 Apr 2004
Offline Last Active Mar 02 2013 02:23 PM

Topics I've Started

Questions about bone orientations in Matrix Palette Skinning

04 February 2013 - 08:29 PM

I am currently adding the option to import many 3D file formats into our engine.  Collada/FBX/etc.  Some formats like Collada explicitly give a bone Matrix/Orientation like so:

 

<node name="leg_left_toes" id="leg_left_toes" sid="leg_left_toes" type="JOINT">

<matrix sid="matrix">1.000000 0.000000 -0.000000 0.135309 -0.000000 1.000000 0.000000 0.000000 0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000</matrix>

 

While others only give a position and then just give xyz translation for each bone:

 

spine lower
1 //This is a joint index
0 1.06035 -0.00128843

 

In formats where there is only a position when they are imported into Max/Maya/Motionbuilder they somehow recalculate the same orientations.  

 

A) How can you get the bone orientations from a list of positions?

B) From what I can tell it looks like it has to do with their children bones with a single child simply point their X-Axis to their child, but what about bones with multiple children (Like the Hips in most skeletons)?  Or no children (Like fingertips)?

C) Why do all of these toolsets choose to face the X axis to the child/children?  I would figure Z would be the most natural choice.  Easy mirroring perhaps?

 

Thank you in advance to all who help =).  


Problems with Windows hooks

11 November 2011 - 02:20 AM

I am trying to read Windows Messages from another window. I have gotten this code to work with notepad:


 HINSTANCE HookhInstance = NULL;
 DWORD ThreadId = 0;
 DWORD ProcessId = 0;


 HookhInstance = GetModuleHandle( __TEXT("user32") );
ThreadId = GetWindowThreadProcessId(InputWindow, &ProcessId);
hkb = SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)MyHookProc,HookhInstance,ThreadId);

if(hkb != NULL)
 {

char title[80];

 GetWindowTextA(InputWindow,title,sizeof(title));
 string titlestring(title);
 cout << "hooked " << titlestring << endl;
 }


and my hook proc:


LRESULT CALLBACK MyHookProc(int intCode, WPARAM wParam, LPARAM lParam)
{
	cout << "HookProc" <<endl;

}


The code works fine when reading from notepad. I get the "hooked" text in my program and it says the correct name of the window. When I use the keyboard in notepad i get the "HookProc" text in my program.

The problem is that when I try to use this same program to target something other than notepad. I get the dialog that says I hooked it properly so I believe I am hooking the right window, but none of the keyboard messages are making it back to my program.

I am trying to follow the logic of spy++:
http://blogs.msdn.co...-internals.aspx

I have used a program to make sure that the program I am trying to read messages from is using user32 since I am placing my hook there:
http://www.dependencywalker.com/

I believe it has to be possible because spy++ is somehow able to get the mouse/key info i would like to have. I have tinkered around with this for a while and I am starting to get stumped. Any help would be greatly appreciated.

Ty for any help in advance =).


edit: sorry about the weird spacing in code brackets i just cant get it to look right lol.

3D Rotations From Collada

25 March 2011 - 11:18 AM

I am writing a collada importer for my engine and i get to this:

<rotate>-0.5767782 0.5784926 0.5767783 -119.8846</rotate>

now it looks like a normal rotate xyzw rotate (rotate w degrees around arbitrary axis xyz). So i use this:

void Node::Rotate(float x, float y, float z , float w)
{
Rotate(XMQuaternionRotationAxis(XMVectorSet(x,y,z,0),w)) ;
}

void Node::Rotate(XMVECTOR Input)
{
*LocalOrientation *= Input;
RotationMatrixNeedsUpdate = true;
}

but its still not rotating right. Anyone know how to read this?

edit: i know the yaw/pitch/roll rotation is
x 89.99 y -0.18 z -89.99 from 3ds max

[D3D11] Alpha Transparency Trouble

03 March 2011 - 12:21 AM

I am trying to do a simple alpha transparency. For now I am just manually setting the alpha in the pixel shader like so:


float4 PS( VS_OUTPUT input ) : SV_Target
{
	float4 FinalColor = txDiffuse.Sample( samLinear, input.Tex );//* float4(1.0f, 1.0f, 1.0f, 0.5f);
	
	//FinalColor.r = 1;
	//FinalColor.g = 1;
	//FinalColor.b = 1;
	FinalColor.a = 0;
	return FinalColor;
}

and setting the blend state like so:


D3D11_BLEND_DESC BlendStateDescription;
	BlendStateDescription.RenderTarget[0].BlendEnable = true;

	BlendStateDescription.RenderTarget[0].SrcBlend			= D3D11_BLEND_SRC_ALPHA;	//D3D11_BLEND_SRC_COLOR;
	BlendStateDescription.RenderTarget[0].DestBlend			= D3D11_BLEND_INV_SRC_ALPHA;//D3D11_BLEND_DEST_COLOR;
	BlendStateDescription.RenderTarget[0].SrcBlendAlpha		= D3D11_BLEND_ONE;//D3D11_BLEND_SRC_ALPHA;
	BlendStateDescription.RenderTarget[0].DestBlendAlpha	= D3D11_BLEND_ZERO;//D3D11_BLEND_DEST_ALPHA;
	BlendStateDescription.RenderTarget[0].BlendOp			= D3D11_BLEND_OP_ADD;
	BlendStateDescription.RenderTarget[0].BlendOpAlpha		= D3D11_BLEND_OP_ADD;
	BlendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;

	mBlendState = NULL;
	g_pd3dDevice->CreateBlendState(&BlendStateDescription,&mBlendState);

 float blendFactor[] = {0,0, 0, 0};
	UINT sampleMask   = 0xffffffff;
	g_pImmediateContext->OMSetBlendState(mBlendState,blendFactor, sampleMask);


I am also clearing the depth stencil view every frame:


g_pImmediateContext->ClearDepthStencilView( mDepthStencilView, D3D11_CLEAR_DEPTH| D3D11_CLEAR_STENCIL, 1.0f, 0 );
	

but I still get no transparency...

Im almost sure that I am setting up the blend state right. Im pretty much copying it straight from my working DX10 code. What am I doing wrong here?

D3DX11 and tga

26 February 2011 - 08:04 PM

I cannot get a tga file loaded via D3DX11CreateShaderResourceViewFromFile

hr = D3DX11CreateShaderResourceViewFromFile( g_pd3dDevice, Input.c_str(), NULL, NULL, &Result->mShaderResourceView, NULL );

the hr results in 16389 (with HRESULT_CODE(hr) )


according to msdn it should return one of the values on this list:

http://msdn.microsoft.com/en-us/library/ff476174(v=vs.85).aspx

and 16389 isnt on that list.




Im pretty sure DX11 can support old school TGA right? It works fine with dds, bmp, etc. Just the few TGAs i have tried do not. Any reasons why this wouldn't work?





PARTNERS