DX11 DAE Skinning Animation

I’ll be danged if I can find a straightforward example of playing a Collada (DAE) animation in DX11. Something along the lines of the Mesh (EX9.Geometry Collada) help file, but for DX11. Any pointers?

I’ve looked at some of the DX9/DX11 and Collada/Assimp hybrids, but all I have found suffer from serious face/normal issues, and others require a whole universe of packs and vpm overwriting my carefully qualified packs folder. Thanks!

“whole universe of packs” aka mp.fxh, mp.essentials, mp.dx, dx11 and messages. Messages are not important though but it’s required by mp.essentials. You can also download the mp.* packs manually from their corresponding github repo

the simplest i can come up with (sourced together from various examples posted to the forum) is still using the good old dx9 collada pipeline for loading the mesh and then converting it to dx11.

all attempts using Assimp to load the dx11 mesh directly failed for me. while the static mesh itself loads fine, the additional blendweight/indices info doesn’t seem to be there? or maybe just not in the “right” format? hard to tell… also i didn’t find a way to make proper use of all the animation info that assimp provides. here again the old dx9-collada nodes come in handy that already return the joint matrices in the right format.

and while the Skinning11.fx is only a “constant” shader, it at least shows the simple basics of skinning and can easily be adapted from there…

SimpleSkinning11.zip (4.5 KB)

obviously this is not a definitive answer to the problem. also not sure if it works with any other model than the astroboy…

@microdee That’s all great stuff (seriously), but it’s the “closely tightened together” part I am reluctant to introduce as a dependency going forward. But it certainly has been very helpful and educational on this and other things, thank you!

@joreg Thanks for the example! It’s very similar to what I’ve pieced together as well. The problem I am having is I think with the normals, which was not included in your example. What I am seeing is that when I move/rotate the instances, the lighting moves with them; so directional lights are instance, not world, relative.

Here’s a snippet from the tekcor/microdee Instanced_Skinning example that made the above pic when its geometry output was sent into PhongDirectional:

float4 bldw = input.BlendWeight;
float4 bldi = input.BlendId+input.ii*BoneCount;
float4 pos = float4(0,0,0,1);
float4 ppos = float4(0,0,0,1);
float3 norm = 0;
for (int i = 0; i < 4; i++)
	pos = pos + mul(float4(input.cpoint.xyz,1), SkinningMatrices[bldi[i]]) * bldw[i];
	ppos = ppos + mul(float4(input.cpoint.xyz,1), PrevSkinningMatrices[bldi[i]]) * bldw[i];
	norm = norm + (mul(float4(input.norm,1), SkinningMatrices[bldi[i]]) * bldw[i]).xyz;
output.cpoint = mul(float4(pos.xyz,1),iPreTr[input.ii % transformCount]);;
output.velocity = ppos;
output.norm = normalize(norm);

That norm line in the loop appears to have no effect; I can comment it out and just send the input normal to the output and it looks the same.

At first I thought this was a problem in the DX11 ports I was looking at, but actually it appears to be an issue in Mesh (EX9.Geometry Collada) as well, which uses the same formula.

Any ideas? Am I missing something? Thanks!

if you look at the helppatch of Mesh (EX9.Geometry Collada) i’d argue it works correctly. rotating either the object or the camera, the light behaves correctly, right?

EDIT: nope, my bad, indeed the dx9 Skinning effect is broken in that respect!

ouright, so here is the dx9 skinning now with proper phong directional light.

Skinning.zip (1.3 KB)

for dx11 i’d recomend starting from a shader you fancy (e.g. the standard phongdirectional one) and then just copying the skinning bits over.

1 Like

ah and there i did it: a simple phongdirectional based effect with skinning for dx11:

SimpleSkinningPhongDirectional11.zip (6.0 KB)

Thanks! Which brings me to the next problem I’m seeing, again I think related to normals: turn on back culling in that example and see what happens - it’s like the faces are reversed. I have been able to work around this by using the geometry from the DX11 Assimp Mesh node, instead of going through the mesh conversion when going into the Instanced_Skinning node, but that does not work here.

Is that a problem in FromEX9Mesh?

Skinning11Cull.v4p (13.6 KB)

I tried inverting the normals in FromEX9Mesh and that did not work, the only thing that did was to invert the position in there, and then transform the whole model back. Seems like the wrong approach though…

indeed. now while i cannot say where things are going “wrong” here exactly, there is an easy fix. instead of inverting the normals, we have to invert the order of the triangles indices:
SkinningPhongDirectional11.zip (6.0 KB)

this video explains the concept of how the order of indices determines the direction a triangle faces.

got it. the answer to your " serious face/normal issues" is right there in the helppatch:

if you do that, the flipping of the order of indices (as i suggested previously) is not necessary, like so:
SkinningPhongDirectional11.zip (6.2 KB)

Ahhh, light dawns over Dunderhead! That explains why the Collada mesh had this “problem” and the Assimp import of it did not. I REALLY should make looking in Herr Inspektor more of a habit…thanks a ton!

i would suggest to go for microdees solutions as they are the best for work with skeletons, you can even spread the anim stacks, i made stuff like this with it:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.