Page MenuHome

Alembic override frame causes fluid sim mesh to have artifacts
Open, NormalPublic

Description

System Information
Operating system: Windows-10-10.0.17763 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.20

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash: rB26bd5ebd42e3
Worked: (optional)

Short description of error
when exporting a fluid sim mesh using alembic then importing it back in and clicking override frame so you can animate it the mesh starts having artifacts. video of the bug here https://streamable.com/4hh28

Exact steps for others to reproduce the error
export a short baked fluid sim as alembic, import it back in as alembic, click override frame on the alembic modifier and scrub through the frames

blend file
the alembic file

Details

Type
To Do

Event Timeline

Ryan G (rlguy) added a subscriber: Ryan G (rlguy).EditedThu, Nov 28, 5:53 AM

I am also able to reproduce this issue importing the Alembic cache into a scene. It seems that the odd behaviour only occurs between frame 8.0 and 9.0 in the Override Frame settings.

Here is frame 8.0:

Here is frame 8.5 which shows the issue:

Here is frame 9.0:

Note: this fluid simulation was created in the FLIP Fluids addon where the object mesh data is updated procedurally within the frame_change_post_handler. Adding this information in case it is relevant.

Sybren A. Stüvel (sybren) lowered the priority of this task from Needs Triage by Developer to Normal.Thu, Dec 5, 3:48 PM

This is caused by the interpolation of vertex positions between frames. This interpolation causes smooth transitions from one shape to another, and is important when slowing down things like animated characters. When vertices are added or removed, this interpolation is no longer possible. After all, you can't have half a vertex in between the two frames. The Alembic importer tries to detect such situations, but as you see, this can fail. What's happening is that between frames 8 and 9 some vertices change wildly in their position, swapping places between the front and the rear of the sphere. However, the number of vertices, edges, and faces stays the same, so the reader thinks it can interpolate, causing the observed behaviour. Detecting such changes is hard to do, because even a large change from one frame to another could still be valid, and it would also have a performance cost.

As a workaround, you can force the overridden frame to be an integer. That way there won't be any interpolation done, hence this issue won't present itself. The easiest way to do this is to add a driver that enforces this. This is the setup I made for you:

  • Add a custom property to the object you want to use for overriding the frame. Name it frame_override, set the value and default value to 1 so that it becomes an integer. Set the min and max to resp. 1 and 20.
  • Add a driver to the Frame field of the Alembic file that has scripted expression var.
  • Add a variable var to the driver that points to the object and set its data path to ["frame_override"].
  • You can now use the custom property to override the frame number and it'll always be an integer.

Here is your blend file with this workaround applied:

I'm marking this task as 'To Do' (instead of 'Bug'), as it has a workaround and is not that common to see in the first place. A possible longer-term solution could be a way to disable interpolation for a specific mesh, so that transformations can still be interpolated while still avoiding the observed issues. This isn't as simple as integer frame numbers, though, as Alembic has a different way to encode time and also potentially more or less samples per frame. I see that as a new feature, though, and not so much a bugfix. Another solution would be to have some property in Alembic that can be used to detect such meshes (when reading), or to mark meshes as topology-changing (when writing), but that would also require a proper design.