Sign in to follow this  
RobMaddison

BlendIndices and BlendWeights not appearing in shader (PIX)

Recommended Posts

Hi all

 

I'm having issues getting skinning working with some animation I've imported.  Do you know if PIX should show the blend indices and blend weights values in the 'PreVS' Details window when the Mesh tab is selected?  I can see my figure being drawn as a mesh, but I think the animation isn't working because the blend weights and indices aren't making it to the shader (for some reason).

 

I'm using ID3DXMesh and the DrawSubset event shows:


SetVertexDeclaration

SetStreamSource

SetIndices

DrawIndexPrimitive

 

All the items look good, the vertex declaration (in PIX) looks like this:

 

 

Stream Offset Type Method Usage UsageIndex 0 0 FLOAT3 DEFAULT POSITION 0 0 12 FLOAT2 DEFAULT TEXCOORD 0 0 20 FLOAT4 DEFAULT BLENDWEIGHT 0 0 36 FLOAT4 DEFAULT BLENDINDICES 0 0 52 FLOAT3 DEFAULT NORMAL 0

D3DDECL_END

         

 

And my vertex and index buffers look good.  Can't see the blend and weight values in the shader though, it's just:

 

VTX, IDX, Position, Normal, TexCoord0

 

Any ideas?

 

My skinning has worked before, but this model and animation has been  loaded from Mixamo.  I can see all matrices being calculated correctly and my matrices are making it to the shader.  For some reason, the blend and weight values aren't coming through.

 

Thanks

Share this post


Link to post
Share on other sites

After much testing, I've come to the conclusion that my blend indices and my blend weights are coming through correctly.  I can tell this by setting the 'x' component of the position vertex to the blend indices[0] and I get what I would expect, a flat model slightly skewed in places in the x direction.  Same goes for the weights.

 

I'm also pretty sure that my matrices are coming through correctly.  For testing I've set all my matrices to the identity and I can see that the values are being passed through correctly (by doing the same as the above but by accessing [0][0] of matrix[0], etc...  However, only 64 matrices are going through (my skeleton has 113 bones).

 

Is this the maximum number of matrices you can set with SetMatrixArray?  If so, how would it be done for models with more bones?  I've been pulling my hair out over this for 3 days :(

 

Thanks

Share this post


Link to post
Share on other sites
Ah thanks, although I was hoping that wasn't the case.

So is this done usually by just ensuring that the models created in packages such as 3ds max have limited bones? Or do the animators create what they want and the model is split in asset converters?

Seems to me that a good skeleton for a humanoid would be around 50-60 bones but that doesn't include facial animations or toes (not required anyway). If I wanted facial animation (which I will at some point), would it be better if I just had body mesh (and skeleton) and separate head mesh (inc skeleton for facial animation)? To place the head correctly, I guess I would need to 'borrow' the hip, spine and neck bones from the body skeleton to ensure it lined up properly.

Am I on the right page?

Share this post


Link to post
Share on other sites

Sounds about right to me, but honestly I can't help you there. As a hobbyist I have no experience with professional content creation and rendering - and little with 3D anyway. Splitting a model sounds challenging, though.

 

But another alternative comes now to mind: Vertex texture fetch, i.e. encode your bone matrices into textures and get them with tex2Dlod in the vertex shader. Can't remember where I saw this, but it's one way to bypass the shader constant limit. Needs shader model 3.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this