• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Blender animation problem

spotlope

FSDevConf team
Messages
340
Country
unitedstates
I've been doing some testing and research today, and it seems that I'm not completely crazy - there is definitely a problem with how Blender is exporting bone animations.

I made a simple test file that uses 3 bones to animate a simple 4-sided column with 6 segments. It wags back and forth, starting in the "wag to left" position. For reference, here's a video of what I see in Blender:


As a control, I had a friend do the same animation in 3DS Max and export to an animated MDL. I did the same. We examined both of the resulting MDLs in ModelConverterX.

The result was that the 3DS Max MDL animated in MCX exactly as it looked in the 3D program, which is what I'd expect. The MDL exported from Blender, however, gave a completely different animation, and looked nothing like the animated movement in Blender.

The crux of the problem seems to be the setting of the starting transformation/rotation on frame zero in the Blender export. Frame zero in the 3DS Max version already had the transforms applied correctly. In Blender, however, frame zero seems to always start with the resting pose, with all calculations being applied to that instead of a transformed pose.

I've been advised to simply deform my resting pose to match what I want to see in frame zero. That does indeed work, and I've done it successfully. However, that assumes a fairly simple animation, and leaves out the possibility of importing much more complex character animations from sites such as Mixamo.

What I'm aiming for is to figure out and fix the Blender animation exports so they match that of 3DS Max.

I've attached a zip with the .x, .xanim, and .mdl files for both the Blender and 3DS Max versions of this object. I'd appreciate it if anyone with knowledge of the internals of exporting Blender files could have a look and maybe give this some thought. I'm doing the same, of course, and will let everyone know if I come up with any insights.

thanks,
Bill
 

Attachments

  • simple_animation_test.zip
    14.4 KB · Views: 197

krispy1001

Resource contributor
Messages
707
Country
unitedstates
Hi Bill!

Could you send me your "simple_animation_test" Blender file so that I can look at it.

Also you may want to downloaded my animated pilot and see if you have problems with it working in FSX. I have had no problem with my animations with the pilot working in FSX.

Thanks, Kris
 

spotlope

FSDevConf team
Messages
340
Country
unitedstates
Sure, Kris. In fact I'll upload it here so anyone who's interested can look at it.
 

Attachments

  • anim_test.blend.zip
    126.2 KB · Views: 206

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
It's very important to set the rest pose correctly. Also, bones in Blender have three edit layers: Object, Edit and Pose. Once you start working with Pose, the same armature in Edit mode will look different and vice versa.
 

spotlope

FSDevConf team
Messages
340
Country
unitedstates
The problem is that the animations aren't exporting the way they look in Blender, nor are the exporting correctly compared to 3DS Max. Read my original post carefully and examine the files and you'll see what I'm talking about.
 

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
Ok, I got your file and I see what's happening.

For myself, I never experienced this. I have my T.5 landing gear animated with bones (complex enough for me).
- At frame 0, the complete assembly is retracted.
- At frame 100, the gear is extended, with compressed shock struts.
- At frame 200, the shock struts are fully extended.
Just as it should be. The rest position however is the same position as on frame 100.

This works correctly in FSX, but not in MCX: all parts fly around AND the animation is starting from the rest position. All parts flying around is probably due to my use of constraints here.

Another skinned mesh is my yoke in the T.5 VC.
- At frame 0, full forward and left.
- At frame 50, neutral.
- At frame 100, full backward and right.
Again, just as it should be. The rest position here is the same as on 50 (so neutral).

In FSX, this works correctly, and again not in MCX. The animation starts from rest and moves twice as much back- and rightward as it should. Comparable with your animation.

I have however imported your file into FSX and it plays very well, just as it does in Blender!

Now I started looking at both .xanim files.

upload_2017-4-12_20-6-17.png


We can very well spot the differences. For example, location animstreams are fully exported in. Blender, while in 3DS only the start and end frame are exported.
But moreover: the animation sequence in the 3DS script runs according to the Blender animation in MCX :eek: So:
- Frame 0 in the 3DS.xanim is 0,0,0,1, so the worm straight up.
- In the Blender.xanim, it is 0.26,0,0,0.97, which exactly corresponds to the position on frame 0 in Blender.

I can't find inspiration to draw a good conclusion on this now, but probably we're getting somewhat closer.

Cheers, Daan
 

spotlope

FSDevConf team
Messages
340
Country
unitedstates
I'm just thinking out loud here, but could the type of animation tag applied have some effect? One difference between the animations used in an aircraft and that of scenery is that the aircraft has specific animation tags that tie the anims to simulator events (yoke travel, rudder deflection, etc). Those animations also have defined start and end frames, according to the SDK. The scenery animations, like the one I did, are tagged as ambient, and just run whatever length is set in Blender. Maybe it's nothing, but there might be a difference in how those two types are exported.
 

krispy1001

Resource contributor
Messages
707
Country
unitedstates
Hi Mr. Bill!

I have looked at your Blender animation test project. The first thing that I see that is not correct, is that your "rest position" does not equal your "pose position". I have modified your animation and I have tested it in FSX. Both animations are the same, in Blender and FSX.

For an animation using bones to work correctly in FSX, the "rest position" must equal the first frame "pose position".

I have attached the modified Blender project to this post in a zip file. In the MDL folder you will find the BGL, MDL, .x, .xAnim, .blend, and text file.

Let me know if you have any problems with it.

Thanks, Kris
 

Attachments

  • Red_Worm_Animation.zip
    95.8 KB · Views: 191

spotlope

FSDevConf team
Messages
340
Country
unitedstates
Thanks, Kris. However, as I mentioned in my initial post, changing the first frame of the pose position to match that of the rest position is not possible when using, for instance, character animations imported from another program. I'm aware that it works, but surely it's not the only way to make it work. In 3DS Max, you don't have to reset your rest to match pose. I've tried doing a complex animation such as a character, then changing the rest position to match the pose. The result, predictably, is that the entire rest of the animation is messed up. Each keyframe expresses its rotation and translation in terms of how much it's moved since the last keyframe. What I need is for the blender export to understand a starting point for frame zero, expressed as a change from the resting pose.
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
so what's basically needed is an option similar to "apply pose as rest pose" with the difference that it also biases the animation keyframes accordingly.

something like
Code:
keyframe.transform  = keyframe.transform - (newTransform - oldTransform);
added via a script containing that option.

Or maybe the exporter could do that? :scratchch
 

spotlope

FSDevConf team
Messages
340
Country
unitedstates
Something like that, I think. Essentially, we just need the first frame to come pre-transformed to whatever the first frame of the posed animation is.
 

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
What is working fine in FSX?

The animation. In FSX, the animation works the same as in Blender but not as in MCX.

Here, in the export_fsx.py, the animation section of the .xanim file is generated:

Code:
            for Generator in self.AnimationGenerators:
                for CurrentAnimation in Generator.Animations:
                    if CurrentAnimation.AnimTag == anim:
                        try:
                            if not anim_tag.attrib['length']:
                                pass
                        except KeyError:
                            anim_tag.set("length", "{:8f}" .format(CurrentAnimation.KeyRange))
                        # write rotation keys
                        anim_stream = etree.SubElement(anim_tag, "AnimStream")
                        anim_stream.set("name", "Rotation")
                        anim_stream.set("id", "0")
                        anim_stream.set("partName", CurrentAnimation.SafeName)
                        anim_stream.set("length", "{:8f}" .format(CurrentAnimation.KeyRange))
                        for Frame in sorted(CurrentAnimation.RotationKeys.keys()):
                            rot = CurrentAnimation.RotationKeys[Frame]
                            keyframe = etree.SubElement(anim_stream, "Keyframe")
                            keyframe.set("time", "{:8f}" .format(int(Frame)))
                            keyframe.set("data", "{:8f};{:8f};{:8f};{:8f}" .format(-rot[1], -rot[2], -rot[3], rot[0]))
                            keyframe.set("type", "Quaternion")

I'd like to know how it works from 3DS max.
 

spotlope

FSDevConf team
Messages
340
Country
unitedstates
Oh, I see what you mean about it working in FSX. That's odd. The last time I did a test file like this, it had the same problem in FSX that it did in ModelConverterX. I didn't even check this one. Looks like the problem is a non-problem - at least for now. Thanks for looking at it!
 
Top