How to keep a LOT of animation data

Hi everyone,
imagine a scene with for example 10 000 frames and 5 000 fcurves with keyframes on every frame (for example mesh grid and every vertex location x, y and z is animated by fcurve). It’s a huge amount of data. Blend file size is in gigabytes.

Now I’m baking data into fcurves this way:

  1. move to frame 1
  2. insert keyframe for each fcurve
  3. move to next frame and repeat step 2

First frame takes fraction of second, but every single frame is slower and slower and goes into 10+ seconds per frame later. This can be frustrating and not acceptable by users. This can also make Blender crash. I would like to make it more linear - like 1 second per frame, but constant.

I found out that using fcurve.convert_to_samples() makes the result file smaller. But it’s impossible to add new keyframes once converted to samples. So I have tried to make fcurve with 10000 dummy keyframes, call fcurve.convert_to_samples() and then set the values in fcurve.sampled_points[index].co[1]. BUT creating the initial fcurve with 10 000 dummy keyframes takes too much time.

Any ideas how to write so much animation data? Is there any way how to write it on disk in some format instead of classical fcurves? Any idea is welcome.

This sounds like a lost battle to me. Why even have fcurves at this point? Might as well export a copy of the entire model for every frame.

Where does the data come from? Was it generated? Or was it sampled from somewhere (e.g. real world data)?

Also where does the data ultimately need to go?

I have an add-on for audio visualization. You can render everything without this crazyness, but in case you want to render your animation somewhere in cloud or anything, you can bake it. I should just probably discourage my users to bake things in case like this…

Here is an example what can be done with it: https://www.youtube.com/watch?v=Kc5NW63Zs-M

If you have a mesh grid 40x40 for example, it makes 1600 vertices * 3 axes = 4800 fcurves. I was testing it on smaller objects and lower number of frames, so I didn’t run into such problems and didn’t even think about it, until a user complained that his Blender crashed while baking.

Exporting model for every model sounds like a good idea, I will investigate this option.

Well, in that case, the audio data is the animation data. I don’t know what exactly your addon does, but I guess you do some sort signal processing like fast Fourier transform; have you ruled out having Blender’s animation system do it for you? (I really have no clue; wild guess)

Yews, it’s all about FFT. But it supports also MIDI.

In case of AudVis Shape Modifier, I have two Shape Keys and for every frame, I read one shape key data, do all the math on all the vertices, and put the data into second shape key. Here is the keyframing part of code

With python, you can use keyframes on almost everything. In case of vertices, you can’t do it from UI, but you can with python. Simplest example:

C.object.data.vertices[0].keyframe_insert('co')

USD export with “Animation” option enabled is probably the best option. Thanks, your reply kicked me to the right direction.

1 Like