Is the new tire animation system possible in blender?

do you guys have a working sample?

I continue to have issues even with the corrections from @DA40CGDFQ & @Sal1800

“Accessor type is not of type SCALAR”

attached blend + gltf

the vs code gltf validator is flagging the sampler’s input and output index, but I don’t have an idea of what that mean

animatedTest.zip (167.4 KB)

Yes, confirmed - Blender exporter is still not set up correctly yet for animated materials.

ASOBO - perhaps a error message that says accessor # X is invalid.

I was able to successfully export multiple UV material animations. But it was very unreliable. It only worked on a freshly opened Blender. Which does give a clue what might be happening.

I’ll post some example files and more details in the morning. But my latest finding seems to be that when you run the export once, the gathered_material_actions Set retains the list of animations and skips past them the next time. But it still tries to insert a sampler with incorrect keyframe data. The binary data does not match the accessor type.

The way I am seeing how the animations are exported to the gltf is with a custom tool. It’s the keyframe data (sampler) that is stored in the binary buffer.
This screenshot shows a working sample of animation data with sampler0 for the channel target as scale and the sampler1 is used for the material animation with SCALAR keyframe values.

The scale animation is just a dummy because there needs to be a channel target. Only the material is animated due to the extension which associates the sampler’s data to the material index.

When the data is corrupted, it can be any number of incorrect data types or mismatched frames like the second one.


image

In this screenshot, line 221 is testing to see if the animation has already been gathered. You can see in the left column that the Set is already populated from the previous export so it will skip reading the data for this animation.

From my previous findings, I modified io/exp/msfs_export.py to clear the gathered_material_actions Set post finalizing of the material animations. This allows for correct repeated exports.

    def gather_gltf_extensions_hook(self, gltf2_plan, export_settings):
        msfs_parameters = bpy.context.scene.msfs_multi_exporter_settings
        if not msfs_parameters.enable_msfs_extension:
            return
        AsoboPropertyAnimation.finalize_material_animations(gltf2_plan, self.material_animations, self.place_holder_action_names)
        AsoboPropertyAnimation.clean_placeholder_actions(self.actionstoclean_objects_map)
        # Clear gathered material animations
        self.gathered_material_actions.clear()

One detail is that I am keeping these as actions instead of pushing to a NLA strip. This is because the result is the same. It seems to only use the material action name even when it’s in a NLA strip with a different name. This seems to be a different issue.

Ideally, we would prefer to use NLA strips and attach the material animation to the same animation as the wheel rotation. This is how the sample DA62 tire animations are constructed. With my current setup, I need to use multiple animations in the behaviors to control them.

I have attached a Blender file and the result of the export to inspect.
Cessna 206H_tundra_gear_1.5.1.blend.zip (753.0 KB)

For comparison, this is the gear_L gtlf from the sample DA62. l_gear_rolling is the rotation animation for the wheel node using sampler0. sampler1 is the UVOffset animation for the L_Tire_Still material (index 1) and sampler2 is the L_Tire_Blurred material (index 2). This would be the preferred way to construct the animations and I plan to look into this further.

2 Likes

I can follow what you are doing - and I have tested this myself and come to same conclusions and have added your code fix and get better results using mamu’s example blend.

Thanks for the excellent work on this.

EDIT: to Mamu - looks like animation tag is no longer valid in 2024 - you must use templates

maybe my error - had animation inside < Behaviors >

But color will not change - stays red

thanks Rohn (and of course Sal)
the tag works corretly in 2024,

With the fix from Sal the glTf is now correctly formed, and the compiler doesn’t throw errors.

i would say Eureka, but is not yet stable, after a few export and modifications the blend gets somewhat corrupted

attached working cube (gltf + blend)

animatedTest.zip (320.4 KB)

I found something interesting in the code and the export settings.

I now know what Rest & Ranges - the 'Limit to Playback Range" is.

If you have an animation - 0 to 60 Key Frames - and in the Blender Output Properties panel (on he right) - it will have a setting for “frame Range” - Start, End and Step.

Checking “Limit to Playback Range” will NOT pick up frame zero in the 0-60 Animation on the export. in this case Output Properties is 1 - 60 steps of 1 (not zero to 60)

The code

            if bpy.app.version >= (3, 6, 0):
                if export_settings['gltf_negative_frames'] == "CROP":
                    frames = [f for f in frames if f >= 0]

                if export_settings['gltf_frame_range'] is True:
                    frames = [f for f in frames if f >= bpy.context.scene.frame_start and f <= bpy.context.scene.frame_end]
                    print("gather_fcurve_keyframes - frame range", frames)

use the Output properties frame values rather than the animation start and end values.

gather_material_actions - before test None
gather_material_actions - in the nla track <bpy_struct, NlaStrip("changeColor") at 0x000002778847E168>
gather_material_actions - in the nla track - append changeColor
gather_channels_fcurves <bpy_struct, FCurve at 0x000002778C197688>
gather_channels_fcurves - length found 4
gather_channels_fcurves - channels_map dict_values([[<io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.AsoboChannel object at 0x00000277814804F0>]])
gather_channels_fcurves - channels_map loop [<io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.AsoboChannel object at 0x00000277814804F0>]
gather_fcurve_keyframes <io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.AsoboChannel object at 0x00000277814804F0>
gather_fcurve_keyframes - frames before [0.0, 20.0, 40.0, 60.0]
gather_fcurve_keyframes - frames after [0.0, 20.0, 40.0, 60.0]
gather_fcurve_keyframes - frame range [20.0, 40.0, 60.0]
gather_fcurve_keyframes - frame loop 20.0
gather_fcurve_keyframes - frame loop 40.0
gather_fcurve_keyframes - frame loop 60.0
gather_fcurve_keyframes - frame keys loop 20.0 <io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.Keyframe object at 0x0000027781480430>
gather_fcurve_keyframes - frame keys loop 40.0 <io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.Keyframe object at 0x0000027781482B30>
gather_fcurve_keyframes - frame keys loop 60.0 <io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.Keyframe object at 0x0000027781482B60>
finalize_material_animation - material_channel <io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.AsoboChannel object at 0x00000277814804F0>
finalize_material_animations - animation <io_scene_gltf2.io.com.gltf2_io.Animation object at 0x0000027781DCA4D0>
finalize_material_animation - material_channel <io_scene_gltf2_msfs_2024_for36.io.com.extensions.asobo_property_animation.AsoboChannel object at 0x00000277814804F0>
gather_gltf_extensions_hook fails on <io_scene_gltf2_msfs_2024_for36.glTF2ExportUserExtension object at 0x0000027781D7F1F0>

all my print statements in the code - Notice

gather_fcurve_keyframes - frames before [0.0, 20.0, 40.0, 60.0]
gather_fcurve_keyframes - frames after [0.0, 20.0, 40.0, 60.0]
gather_fcurve_keyframes - frame range [20.0, 40.0, 60.0]

there is no zero in the last line with playback checked.

However

gather_fcurve_keyframes - frames before [0.0, 20.0, 40.0, 60.0]
gather_fcurve_keyframes - frames after [0.0, 20.0, 40.0, 60.0]
gather_fcurve_keyframes - frame loop 0.0
gather_fcurve_keyframes - frame loop 20.0
gather_fcurve_keyframes - frame loop 40.0
gather_fcurve_keyframes - frame loop 60.0

there is if you uncheck it.

But this still does not get animated UVOffset to work.

Everyone should set up there Blender defaults to (startup blend file) with Output Properties Key Frame start set to zero (i think)

2 Likes

That’s a good find! An unexpected behavior for sure. Some of the animation settings are not suitable for certain exports and it’s not very clear what they will actually do.

Sampling all frames would be suitable for some situations but it will add a keyframe for every frame of the animation length. This is not really a problem but it does add more data than necessary. Also optimize animation seems to have the opposite effect that it also writes more keyframe data than needed. For the most compact animation, both off worked for me.

Hello,

Good find, we will fix that in the next Core SDK 2024 update.

Thank you,

Yasmine !

The test cube animation of colors still does not work with Blender ASOBO exporter 1.3.2.

Other fixes seem to be ok, however UVOffset as a simple color animation with mamu’s test file does not work for me.

i can get an animation to show up, but it’s far from ideal.

  • to get a full length animation, the start and end keyframes need to be at the limits of the playback range
  • cant set your own name for the animation, stuck with materialname+action
  • doesn’t export as a linear animation, so eases into whatever keyframes are set
  • by default the animation is inverted
1 Like

I can’t get things to work. The animation name you suggest does not make sense to me, as the samples don’t do this,and if I make the animation name as you suggest it still does not work for me. Hoping the new blender DA62SDK helps in this.

I tested the 1.3.2 exporter with my same material setup and it worked as expected. The issues I experienced have been resolved.

There is one remaining detail that is not exactly a defect but is less than optimal is that the action name is always used as the animation name even if it is in a NLA track. Because of this, I am unable to group the material animation with the object animation used for the wheels as shown in the documentation.

@kcgb You can rename the action but only from the NLA editor and not in the action strip editor. The UV offset needs to start at 1 and go to 0 as the keyframes increase to match the rotation direction.

Thank you to the SDK team for the speedy response and fixes.

Unfortunately I don’t see any UV animations in the Blender DA62SDK.

did some additional test, looks like it is possible to animate only UVOffsetV OR UVOffsetU alternatively

When exporting both, only one is played

Creating 2 different animations (1 for U and 1 for V) is worse because only one gets exported in the glTf

Fat fingers in my Project file - I now can animate the cube.

Did you manage to make the animation linear? Thats the biggest issue I’m still having

Yes, it is linear. I think you should check your keyframe interpolation setting. I would delete and add the action fresh just in case.