Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Animation debugging nightmare...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 stu_pidd_cow   Crossbones+   -  Reputation: 2394

Like
0Likes
Like

Posted 09 February 2014 - 07:48 PM

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, 09 February 2014 - 10:41 PM.


Sponsor:

#2 C0lumbo   Crossbones+   -  Reputation: 3080

Like
0Likes
Like

Posted 09 February 2014 - 11:53 PM


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?



#3 stu_pidd_cow   Crossbones+   -  Reputation: 2394

Like
0Likes
Like

Posted 10 February 2014 - 12:36 AM

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.



#4 ankhd   Members   -  Reputation: 1845

Like
0Likes
Like

Posted 10 February 2014 - 04:56 AM

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..



#5 Buckeye   GDNet+   -  Reputation: 10620

Like
0Likes
Like

Posted 10 February 2014 - 06:53 AM

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, 10 February 2014 - 07:01 AM.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.


#6 stu_pidd_cow   Crossbones+   -  Reputation: 2394

Like
0Likes
Like

Posted 10 February 2014 - 07:22 PM

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.



#7 stu_pidd_cow   Crossbones+   -  Reputation: 2394

Like
0Likes
Like

Posted 10 February 2014 - 08:21 PM

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.



#8 ankhd   Members   -  Reputation: 1845

Like
0Likes
Like

Posted 11 February 2014 - 03:45 AM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS