Jump to content
  • Advertisement
Sign in to follow this  
giugio

skin and send matrix in dx10

This topic is 3253 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hy. I'm try to implement a skin animation. My problem is that now i have all the transformation matrix for each bone of the skeleton,then i have decompose the matrix of each bone in float4 (is a trik of a book) but i can't understand how send an array of D3DXVECTOR4 in the shader, so as the shader can load this float4 array element from an index(the index of bone in the vertex). Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by giugio
but i can't understand how send an array of D3DXVECTOR4 in the shader,
so as the shader can load this float4 array element from an index(the index of bone in the vertex).
Thanks.


You want to send an array of matricies I guess, not an array od 4f vectors that acts like indexes for the the vertex mats, for theese are per vertex info in a stream. You need a per vertex info of bone indicies that influence the vertex, use 4 element vector of floats for indicies . Theese indicies are a stream as well as bone weights. The matricies you index for the given frame in the shader are actual matricies for every bone. You can send an array of floats to a shader uniform with function
ID3DXEffec::SetRawValue(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes);
So for sending for example 8 4x4 float matricies you would use:
SetRawValue(hC,(void*)values,0,8*16*sizeof(float));
Define yourt matrix array uniform like this
float4x4 u_pose[16] : WORLDMATRIXARRAY;
you then have to count on fact that your indicies index a correct matrix in the array ;-), So pay attention to creation of your indicies stream and matrix array.



Share this post


Link to post
Share on other sites
Thanks, but i must send to the shader an array of 80 float4 and in the shader i have a:
#define SKINNED_MATRICES_SIZE_VS20 80
float4 skinnedMatricesVS20[SKINNED_MATRICES_SIZE_VS20*3];
can I send all the float4 array at once?
how?
Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!