Jump to content
  • Advertisement
Sign in to follow this  

HLSL - Multiple World Matrices

This topic is 2880 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

I'm using VB.NET and DirectX9 to animate a mesh. The following code is the Draw function:

p = FX.Begin(Direct3D.FX.None)
For k = 0 To p - 1
For iattrib As Integer = 0 To mesh.NumberAttributes - 1
Dim boneCombo As BoneCombination = mesh.BoneTable(iattrib)
For i As Integer = 0 To mesh.NumberInfluences - 1
Dim matrixIndex As Integer = boneCombo.BoneId(i)
If matrixIndex <> -1 Then
Dim tempMatrix As Matrix = offsetMatrices(matrixIndex) * frameMatrices(matrixIndex).Combined
'DXDEV.Transform.SetWorldMatrixByIndex(i, tempMatrix)
End If
DXDEV.RenderState.VertexBlend = DirectCast(boneCombo.BoneId.Length, VertexBlend) - 1
Next k

As you can see there are multiple world matrices that are passed in different indexes in device. The thing is that I use an HLSL effect file to render the mesh and I don't know how to pass and use multiple world matrices in my effect. I want to replace the commented line:

DXDEV.Transform.SetWorldMatrixByIndex(i, tempMatrix)

with a line that passes those world matrices in my effect and then some HLSL code to use those world matrices in my vertex shader.

Any help will be appreciated.

Share this post

Link to post
Share on other sites
An Effect should have a method for setting an array of matrices, which is what you'll want to use. Skinning with shaders can be tricky...I would suggest looking at the skinning samples in the DirectX SDK for some guidance.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!