Jump to content
  • Advertisement
Sign in to follow this  
anders211

distortions during animation

This topic is 2129 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 have problem that my animations have some fast distortions. They occurs when I use hw skinning (vertex, pixel shaders) or software skinning. However those distortions doesn't occur with blender in which I did animation and assimpViewer. So if the problem doesn't occur with assimpViewer it means that for sure my model was exported from blender to x file in OK way. Here is a movie in slow motion which demonstrate the problem (unfortunately there is advertisement which lasts 30 s before my movie):

http://anders211.wrzuta.pl/film/4YKT9BNgNDB/fg_2013-11-16_17-16-23-78

 

You see like legs/arms sometimes have some unnatural jums/distortions, I don't know how to name it.

Do You know what might be the reason of the distortions? Might be this problem related to some I don't now - not synchronized screen frequency with something? Or maybe somehwere calculations are wrong, however my vertex shader is acc. to some tutorials. I just multiply vertex position with Final matrices and weights. It should be OK.

 

Thanks in advance for information.

Share this post


Link to post
Share on other sites
Advertisement

Hard to tell what the problem is from just the video. Are you storing your rotations as quaternions? Remember, if a quaternion q represents an orientation, then -q also represents that same orientation. My guess is that your animation data is storing quaternions that need to be flipped in order to interpolate correctly, otherwise it'll try to interpolate the "long way" around and you'll get artifacts like what you're seeing in your animation. 

 

Here's a good stackoverflow post on the problem: http://stackoverflow.com/questions/2886606/flipping-issue-when-interpolating-rotations-using-quaternions

Share this post


Link to post
Share on other sites

Hi, I am storing in x file as quaternions (the below example) because somebody told me that it is better to keep in .xml scale, position and rotation separately rather than one matrix.

So when I am using AnimationController (I don't interpolate on my own between keyframes) the only one solution for the problem is to add more keyframes?

Because I am not able to do the below hint as this is done automatically by AnimationController::update method.

Try taking the dot product of your two quaternions (i.e., the 4-D dot product), and if the dot product is negative, replace your quaterions q1 and q2 with -q1 and q2 before performing Slerp.

I will check if adding more keyframes for rotation can fix the issue.

 

 Animation {
    {Armature_spine1}
    AnimationKey { // Rotation
0;
46;
0;4;-0.999857,-0.000000, 0.000000,-0.016928;;,
1;4;-0.999832,-0.000857, 0.007052,-0.016906;;,
2;4;-0.999480,-0.003272, 0.027435,-0.016609;;,
3;4;-0.998397,-0.006284, 0.054015,-0.015718;;,
4;4;-0.997094,-0.008470, 0.074283,-0.014657;;,
20;4;-0.996548,-0.009199, 0.081269,-0.014210;;,
21;4;-0.997293,-0.014963, 0.070579,-0.014167;;,
22;4;-0.998683,-0.028660, 0.040330,-0.013607;;,
23;4;-0.999172,-0.039019, 0.001966,-0.011358;;,
24;4;-0.999085,-0.033117,-0.025936,-0.007708;;,
25;4;-0.999428,-0.006549,-0.032734,-0.005478;;,
26;4;-0.999516, 0.005182,-0.030497,-0.003351;;,
27;4;-0.999048,-0.030094,-0.031518, 0.001953;;,
28;4;-0.995288,-0.090718,-0.033104, 0.008718;;,
29;4;-0.989655,-0.139011,-0.032936, 0.013184;;,
30;4;-0.987795,-0.152181,-0.030695, 0.012623;;,
31;4;-0.988364,-0.147578,-0.031475, 0.019170;;,
32;4;-0.987554,-0.145867,-0.040474, 0.042681;;,
33;4;-0.985500,-0.143960,-0.055694, 0.070450;;,
34;4;-0.984044,-0.138999,-0.071519, 0.084978;;,
35;4;-0.984795,-0.131059,-0.083216, 0.077954;;,
36;4;-0.987022,-0.117089,-0.092188, 0.059829;;,
37;4;-0.989543,-0.094500,-0.100366, 0.042451;;,
38;4;-0.991459,-0.069558,-0.106583, 0.028478;;,
39;4;-0.992391,-0.051333,-0.110085, 0.020163;;,
40;4;-0.992630,-0.045062,-0.111101, 0.017646;;,
41;4;-0.992744,-0.044823,-0.110234, 0.017294;;,
42;4;-0.993080,-0.044102,-0.107622, 0.016248;;,
43;4;-0.993619,-0.042902,-0.103290, 0.014563;;,
44;4;-0.994321,-0.041238,-0.097325, 0.012341;;,
45;4;-0.995135,-0.039138,-0.089889, 0.009727;;;
46;4;-0.995997,-0.036643,-0.081233, 0.006894;;,
47;4;-0.996846,-0.033802,-0.071695, 0.004016;;,
48;4;-0.997624,-0.030674,-0.061683, 0.001245;;,
49;4;-0.998291,-0.027322,-0.051642,-0.001320;;,
50;4;-0.998827,-0.023818,-0.042002,-0.003641;;,
51;4;-0.999230,-0.020242,-0.033128,-0.005736;;,
52;4;-0.999512,-0.016683,-0.025278,-0.007654;;,
53;4;-0.999695,-0.013240,-0.018588,-0.009445;;,
54;4;-0.999802,-0.010017,-0.013083,-0.011132;;,
55;4;-0.999856,-0.007115,-0.008708,-0.012702;;,
56;4;-0.999875,-0.004627,-0.005356,-0.014110;;,
57;4;-0.999875,-0.002628,-0.002910,-0.015293;;,
58;4;-0.999868,-0.001172,-0.001257,-0.016187;;,
59;4;-0.999860,-0.000293,-0.000308,-0.016741;;,
60;4;-0.999857,-0.000000, 0.000000,-0.016928;;,
    }

Share this post


Link to post
Share on other sites

Hi. if you want a good read if not allready done so the book Advanced Animation with DirectX by Jim Adams is great. ISBN 1-59200-037-1

Share this post


Link to post
Share on other sites

I added keyframes to all frames for all bones and the effect is exactly the same.

In very slow motion mode I notice in walking animation that suddenly leg is rotating 360 over the head:

http://img823.imageshack.us/img823/9007/sw66.jpg

What is interesting here issue happens only with left leg, not with right. Both legs has symetric animation.

Nevertheless what to do in order to use d3dxAnimationController and fix this issue?

Edited by anders211

Share this post


Link to post
Share on other sites

I think this relates to the Quaternion Double-cover technique. Instead of storing the leg rotation between 0-360 degrees, you store them as 0-720 degrees. That way, even if you hit 181 degrees on a key frame, the shortest way back to 0 during interpolation is back the same way you came.

Edited by Tispe

Share this post


Link to post
Share on other sites

Maybe the animation is wrong. redo the animation. It happens sometime. the other viewers may do somthing when there is something missing.

Eg Meshview(app from DX) creates normals for meshes that do not have any.

Share this post


Link to post
Share on other sites

Changing axis system for bones isn't a solution, because it helps not for all cases. I was searching in the google and nobody on the world has problem like me. The best would be to have D3DXAnimationController::advanceTime() implementation but unfortunatelly there is only header. Probably there is a bug in this method which needs correction as You describing above. I will try to contact with microsoft, however probably they will ignore me.sad.png

not possible to contact with them as You have to pay in order to ask the question. If I was God I would do something about this company.

 

It seems that I have to write my own animationController because method advanceTime from directx has serious bug. I am sad because apart from advanceTime I have to implement also KeyTrackEnable, KeyTrackSpeed, KeyTrackWeight etc. as I cannot mix my own advanceTime and methods from directx. However the bug in D3dxanimationController is that the registered max animation sets which it handles is 46 so maybe there is much more issues with this animationController so having my own one wuld be the best solution.

Edited by anders211

Share this post


Link to post
Share on other sites
Hey there. It's not to hard to write your own. Get that book from my last post and it's all in there. And the good news it all works.

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!