Page MenuHome

Alembic: add support for reading override layers
ClosedPublic

Authored by Kévin Dietrich (kevindietrich) on Dec 17 2021, 2:23 AM.

Details

Summary

Override layers are a standard feature of Alembic, where archives can override
data from other archives, provided that the hierarchies match.

This is useful for modifying a UV map, updating an animation, or even creating
some sort of LOD system where low resolution meshes are swapped by high resolution
versions.

It is possible to add UV maps and vertex colors using this system, however, they
will only appear in the spreadsheet editor when viewing evaluated data, as the UV
map and Vertex color UI only show data present on the original mesh.

Implementation wise, this adds a CacheFileLayer data structure to the CacheFile
DNA, as well as some operators and UI to present and manage the layers. For both
the Alembic importer and the Cycles procedural, the main change is creating an
archive from a list of filepaths, instead of a single one.

After importing the base file through the regular import operator, layers can be added
to or removed from the CacheFile via the UI list under the Override Layers panel
located in the Mesh Sequence Cache modifier. Layers can also be moved around or
hidden.


Here is the UI for the layers:

And a video demonstrating the feature:

Files for the unit test:

Diff Detail

Repository
rB Blender
Branch
abc_review_layers (branched from master)
Build Status
Buildable 19779
Build 19779: arc lint + arc unit

Event Timeline

Kévin Dietrich (kevindietrich) requested review of this revision.Dec 17 2021, 2:23 AM
Kévin Dietrich (kevindietrich) created this revision.

Here are some test files: rain_t_pose.abc is the main file from the cache (which is an implicit layer actually), while rain_animation.abc is a layer which adds some animation.

Rabase with master, add a UI panel for the override layers list.

Brecht Van Lommel (brecht) requested changes to this revision.Jan 5 2022, 1:58 PM
Brecht Van Lommel (brecht) added inline comments.
source/blender/blenkernel/intern/cachefile.c
464

Can you just make the index a full int?

Note that I expect anyone to need that many layers, but also don't see the point of limiting things here.

468

Always use calloc unless there is a real performance cost (like large arrays), no need to risk uninitialized memory.

source/blender/makesrna/intern/rna_cachefile.c
171

overwrite -> override

This revision now requires changes to proceed.Jan 5 2022, 1:58 PM
Kévin Dietrich (kevindietrich) marked 3 inline comments as done.

Handle requested changes from review.

This revision is now accepted and ready to land.Jan 5 2022, 2:21 PM
Sybren A. Stüvel (sybren) requested changes to this revision.Jan 10 2022, 11:32 AM

The patch description is missing a vital part: information on how to use this feature! Also see Ingredients of a Patch. Since there are changes to the UI, some screenshots would also be good to include. These are not only important for reviewing the proposed user-facing changes, but you'll need them for the release notes anyway.

Importing one ABC after the other simply gives me two Rain characters:

Also, there is no unit test that covers this new functionality. I think for new code, this is important to have, to cover at least the very basics of the feature.

This revision now requires changes to proceed.Jan 10 2022, 11:32 AM
Kévin Dietrich (kevindietrich) edited the summary of this revision. (Show Details)

Add a unit test for loading a high resolution version of a mesh
though a layer. To support this, RNA functions were added to the
CacheFile to add or remove a layer.

The unit test is just checking that the topology of the mesh
changes after adding and removing the layer, we could also have
some tests for attributes.

The files for the test were attached to the patch description,
which was also updated to add some usage information, and visuals
for the feature.

Ah, now I get how it works! Thanks :)

This revision is now accepted and ready to land.Jan 13 2022, 11:06 AM