Render the skinned mesh

I used Skinning Sample enter link description here for import fbx model with animation in my project. For a long time, I had problems with imports, and finally I was able to solve them and start the project to build. But I was not waiting for a surprise in the form of such a new mistake:

An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, BLENDINDICES0, BLENDWEIGHT0, TEXCOORD0.

And it appears in this part of the code

What’s wrong?

Does the model you’re importing have an armature and animations on it? You also need to have a UV map and texture applied to it from my experience.

I don’t have it with me, but over the last year I’ve compiled a LOT of different things which could go wrong when you import a skinned mesh from Blender. I don’t have the list with me at the moment, but I’ll post it here when I can if the above doesn’t work.

1 Like

seem like your model lack of normal…

2 Likes

I know that there are a lot of mistakes in my 3D model and I do not yet have time to develop a UV map for it now. And I decided to use a ready-made free model enter link description here
This model solved the previous problems, but created a new one not yet known to me.
I always meet “different things”, so I’ll wait for your list.

Very sorry about the delay, but here’s my list. I’m working on a game in which most models are textured and animated, and I’ve run into most of these issues at least once while I’m importing them. These are from my personal notes, and for a few I’m not sure exactly what causes the issue that I have the fix for, but I hope they help.

Problems not caused by armatures/animations:

  • Location of the model should be at [0,0,0] if it’s attached to an armature.
  • Multiple vertices cannot ever be in the same exact location (use “remove doubles” in Blender).
  • There cannot be loose vertices (Blender has a “Clean up” option you can use to check).
  • If a model has no UVs defined, it WILL cause issues. Even if you don’t use a texture, just assign some default UVs to be sure.
  • For some reason for me, if a textures width isn’t equal to its height, then it will appear black (even if both w and h are to the power of 2).
  • If your model imports distorted, try “Apply Transforms” in the export window.
  • Use relative paths for your textures, and be sure the textures can be found at runtime.
  • Make sure your model has normals (try “recalculate normals” in Blender unless your normals need to be custom defined).

Problems caused by animations/armatures (probably won’t apply for this case, but I’ll add it anyway

  • Be sure to have the model be in its T-pose, unmodified pose when you export it. For me, if it’s not in that pose then MonoGame will interpret whatever pose it was in when I exported it as the default, and distort it incorrectly as a result.
  • Check that the animation you want is being exported. Sometimes, some of my animations won’t export and I’m not entirely sure what causes it. Otherwise, add all your animations through the NLA editor, then export it.
  • Check that the model has no vertex groups which are assigned to bones that were deleted (I once redesigned an armature on a previously skinned model and this caused issues).
  • When exporting, be sure to “add leaf bones”.
  • “Clear useless actions” to get rid of any stray animations which may be getting exported and causing issues.

Hope that helps.

2 Likes

WOW!
This is very cool, thank you.:thumbsup: