Jump to content
  • Advertisement
Sign in to follow this  
stu_pidd_cow

Animation debugging nightmare...

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

Hi,

 

I’m trying to do skinning animation with Assimp and D3D11 in VS2012. I have managed to get things looking ok but I have a problem as seen in this image:

 

animation0_zps0b1e8085.jpg

 

No, that is not his long luscious hair. It appears some triangles are completely wrong. I have checked the bones and the vertex information that is retrieved from the file and everything seems right. I also tried recreating the vertex shader on the CPU to see if I could replicate the problem, but there was no problem there either. So I tried debugging a pixel (on his "hair") and I got these values:

 

animation1_zps3ea13b6a.jpg

 

This shows that the bone weights are completely wrong (because they should add up to 1.0). So this must mean that the vertex I sent to the GPU is wrong, right? Going back to the CPU side, these are the exact values I sent (for vertex 301):

 

animation2_zps992710e6.jpg

 

The highlighted stuff shows that the bone weights do indeed add up to 1.0. So when I check on the GPU side, I see this:

 

animation3_zps7f4b34ab.jpg

 

The red part shows that the bone weights are there on the GPU. The interesting thing is that the highlighted green stuff are the actual values that the bone weights are given. It is sort of like the vertex buffer has gone out of synch or something (but I am sure this is a user error). I have made sure that I have sent the correct vertex buffer size and vertex struct size.

 

Sorry, I know this is a complicated question, but I'm not sure what else to try. I'm not sure what code to give you, so just ask and ye shall receive. I'm also not sure if this is a D3D problem or an animation problem or whatnot. So does anyone have any idea what the problem could be or things that I could try?

 

Thanks.

Edited by stu_pidd_cow

Share this post


Link to post
Share on other sites
Advertisement


I have made sure that I have sent the correct vertex buffer size and vertex struct size.

 

That sounded like the most likely cause and might be worth rechecking. The only other thing that springs to mind is that you might be sending the wrong value to NumVertices in your call to DrawIndexedPrimitive?

Share this post


Link to post
Share on other sites

Thanks for the reply. I have rechecked these things but I can't seem to find anything wrong with these things. I thought maybe there was something wrong with the indices, so I got rid of them (ie just use vertices in the given order) but this showed similar results.

Share this post


Link to post
Share on other sites

hello. every time I get a mesh that looks like that I load it in another viewer  like mesh view or some thing that you know works and renders meshes.

Because some times the exported mesh is messedup and it not your code. See some of my meshes came out like that and I messed with them and it was the exporter

not my code hours and hours here.

Is this a valid mesh..

Share this post


Link to post
Share on other sites

What file format are you using for the mesh? Do other files render correctly?

 

If it's a DirectX x-file, I second ankhd's comments. Look at your file with mview or DXViewer. The code for those viewers is much more generalized with regard to mesh structure than yours may be.

 

Also, as ankhd mentions, it may well be a problem with the file, not your code.

 

I had a similar problem and it was caused by vertices that were unweighted, or weighted to the root frame rather than, .e.g., to the head bone. For the offending vertices (if you can determine them,) see if the weight bones are the same as adjacent vertices. Don't know what modeler you're using, but (if you can) check the weighting of the offending vertices.

 

Also, some x-files I used had more than one mesh and the algorithm I was using assumed a single mesh. Does yours?

Edited by Buckeye

Share this post


Link to post
Share on other sites

I'm using md5mesh and md5anim files (I got the files from the tutorial here). I have tested it by loading it into AssimpView and it looks and behaves perfectly fine, so I don't think there's a problem with the file. The mesh is broken into multiple pieces, but my code caters for this. It draws find in bind pose (without bones).

 

One thing I have noticed is that I cannot check the values in the third vertex in a triangle in the graphics debugger. I'm not sure if this is related. You can see this in my second image (in my original post, where vertex 300's values are not visible). I have also noticed that it is (as far as I can tell) only one triangle in the mesh. It is often the last triangle specified in the index buffer, but not always.

 

I have checked and rechecked my input layouts, vertex/index buffer declarations and draw calls but everything seems fine.

Share this post


Link to post
Share on other sites

Holy freakin bejezus, I found the problem!

It turns out I was setting the wrong size for the bone IDs in the input layout. No wonder I was getting such weird results.

 

All embarrassment aside, thanks for the help everyone! I have a lot to play with now.

Share this post


Link to post
Share on other sites

Does the messed up part follow the camera when you move around if so its a transformation matix error some where.

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!