Fix #105409: vertex interpolation corrupts Alembic mesh #105867
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105867
Loading…
Reference in New Issue
No description provided.
Delete Branch "kevindietrich:abc_topology_fix_3.5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Alembic data streaming can optionally interpolate between vertex of
two adjacent frames in order to smooth out the transition between
frames.
However, the decision to interpolate is only based on the vertex count.
This is not too robust as topology/connectivity can still differ even if
the number of vertices is the same (for example physics simulations and
videogrammetry can be set to output the same vertex count, but optimize
the triangle placement). This lead to vertices of unrelated polygons
being interpolated across frames.
To fix this, we now also check if the connectivity across frames is the
same, instead of just checking the topology counters. Although the bug
is revealed by the vertex interpolation routine, a similar fix is applied
to the check on topology change used to decide if the modifier has to be
evaluated.
I would guess Alembic does not store multiples samples of face counts and indices if the topology is the same for the entire animation? If so, this could avoid the overhead of comparison when
.getNumSamples() == 1
. Or maybe it could check if the array data pointers are equal.@ -469,0 +486,4 @@
}
/* Otherwise, we need to check the connectivity as files from e.g. videogrammetry may have the
* same face count, but different connexions between faces. */
connexions -> connections
@ -469,0 +502,4 @@
return false;
}
}
}
memcmp
of the arrays would be a bit faster?@ -469,0 +488,4 @@
/* Otherwise, we need to check the connectivity as files from e.g. videogrammetry may have the
* same face count, but different connections between faces. */
if (memcmp(face_counts->get(), ceil_face_counts->get(), face_counts->size() * sizeof(int))) {
Could the pointers be compared here as well to speed things up in case they are the same?
@ -675,0 +714,4 @@
}
/* Check first if we indeed have multiple samples. */
if (m_schema.getFaceIndicesProperty().getNumSamples() == 1 &&
I guess this does not work for a sequence of Alembic files, only for a single file that contains the full animation? Or is that a different code path?
@ -469,0 +488,4 @@
/* Otherwise, we need to check the connectivity as files from e.g. videogrammetry may have the
* same face count, but different connections between faces. */
if (memcmp(face_counts->get(), ceil_face_counts->get(), face_counts->size() * sizeof(int))) {
I did try that originally but did not notice any difference with or without. Although, we could argue that not having an explicit check on our side is betting on the implementation of memcmp. I would venture that any serious implementation of memcmp would return 0 if the pointers are the same.
@ -469,3 +501,4 @@
static void read_mesh_sample(const std::string &iobject_full_name,
ImportSettings *settings,
const IPolyMeshSchema &schema,
Just to note,
memcmp
gives about 1-2 fps speedup in the file from the bug report (~150k faces).@ -675,0 +714,4 @@
}
/* Check first if we indeed have multiple samples. */
if (m_schema.getFaceIndicesProperty().getNumSamples() == 1 &&
You're right, and there is no different code path for files sequences, so this may break; I did not think of that case. I do have some Alembic file sequences, so I can use those to correct the logic.
@ -469,0 +488,4 @@
/* Otherwise, we need to check the connectivity as files from e.g. videogrammetry may have the
* same face count, but different connections between faces. */
if (memcmp(face_counts->get(), ceil_face_counts->get(), face_counts->size() * sizeof(int))) {
From this, it doesn't seem like something we should rely on:
https://stackoverflow.com/a/58305477
Apart from what @brecht already said, the PR looks good to me.
Accepting so that the patch can be landed once Brecht also approves.
1357054eeb
toe8ea03e793
Fix #105409: vertex interpolation corrupts Alembic meshto Fix #105409: vertex interpolation corrupts Alembic meshFix #105409: vertex interpolation corrupts Alembic meshto Fix #105409: vertex interpolation corrupts Alembic meshSorry for the delayed update.
If a file sequence is being read, then we do a full topology comparison.
In order to detect if a file sequence is read, a new member is added to the base AbcObjectReader class, which is initialized when constructing a new reader. Technically, this information is alredy stored in ImportSettings which is already stored in the class, however, it is a pointer to some stack memory (either the stack from the import job, or the stack from CacheReader_open_alembic_object). This will need to be solved at some point (some of my other patches will remove the need for this object). CacheReader_open_alembic_object also had to be modified to take an extra parameter to tell if the CacheFile is a sequence.
Thanks, looks good now.
Pull request closed