Alembic/USD: use geometry sets to import data #115623
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115623
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "kevindietrich/blender:abc_usd_geometry_sets_review"
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?
This rewrites the Alembic and USD data importers to work with and
output GeometrySets instead of Meshes.
The main motivation for this change is to be able to import properly
point clouds, which are currently imported as Meshes, and curves
data, which suffer from a lot of issues due to limitations of
legacy curves structures (fixed by the new curves data-block) and are
also converted to Meshes. Further, for Curves, it will allow importing
arbitrary attributes.
This patch was primarily meant for Alembic, but changes to USD import
were necessary as they share the same modifier.
For Alembic:
important bug (see note at the end)
For USD:
Note that the current USD importer does not support loading PointClouds,
so this patch does not add support for it.
For both Alembic and USD, knots arrays are not read anymore, as the new
Curves object does not expose the ability to set them. As knots arrays
from other software were always a little problematic to interpret, this
might not really change anything for users.
This fixes #58704: Animated Alembic curves don't update on render
(NOTE: it could be that the fixed curve bug was also present in USD.)
Still going through this and mostly focusing on the non-alembic parts so far. The previous test files still load correctly etc. too.
I'd be remiss if I didn't mention the knots array feedback from last time that's still pending though. I think a major factor here is access to some files so we can better reason about the changes right?
This then lead me to look at
usd_reader_nurbs
and notice it's still using the legacy curve type. Is the note about USD not reading knots arrays correct given that?@ -29,0 +63,4 @@
if (basis == pxr::UsdGeomTokens->bspline) {
return CURVE_TYPE_NURBS;
}
if (basis == pxr::UsdGeomTokens->bezier) {
There's a comment in
main
about/* TODO(makowalski): Beziers are not properly imported as beziers. */
-- Is that still applicable or is that actually ok now? Guessing we need a sample file to check?I don't know what problem this is referring to, so test files would be appreciated.
@ -40,3 +40,1 @@
Mesh *read_mesh(struct Mesh *existing_mesh,
USDMeshReadParams params,
const char **err_str) override;
virtual void read_geometry(bke::GeometrySet &geometry_set,
nit: can remove
virtual
keyword on this one@ -171,0 +186,4 @@
BKE_cachefile_reader_open(cache_file, &mcmd->reader, ctx->object, mcmd->object_path);
if (!mcmd->reader) {
BKE_modifier_set_error(
ctx->object, md, "Could not create Alembic reader for file %s", cache_file->filepath);
Keep this message generic since USD is here now.
@ -209,3 +292,3 @@
const Span<float3> mesh_positions = mesh->vert_positions();
const Span<blender::int2> mesh_edges = mesh->edges();
const blender::OffsetIndices mesh_faces = mesh->faces();
const blender::OffsetIndices mesh_polys = mesh->faces();
Keep the
faces
terminology on this and the below few lines (mesh_faces and me_faces).I will review this pull request early this week. My apologies for the delay.
Are you referring to the discussion on the old patch review on the old website? If so, I think the conclusion is to move ahead and see if that is actually needed. Otherwise, I am out of loop.
I could clarify the description, but this is only about curves data imported with the new Curves, and not NURBS which are still read with the legacy curve object. So the note is right although perhaps confusing.
03620acdc9
to14fb9edc41
Yes, it was just from the old review. I have no further thoughts or data on it either, just wanted to mention it as the description in this new PR is quite similar to the old one which led to questions.
I finished an initial review (focusing on the USD code) and the changes look good. Loading test cases works as expected. I hope to finish the review/testing tomorrow.
There's a few issues with the new Curves object to deal with.
create_bezier_segment_curve
in filenode_geo_curve_primitive_bezier_segment.cc
for a minimal example.@deadpin what is the motivation to import them as the new curve objects? The old one is still the recommended one for non-hair curves, and probably to all the imported curves at the moment.
I just realized that the old curves don't support generic attributes. Is this the main reason to use the new one?
The drawing limitation described on #96455 is something that will be worked on by @fclem . It is still not clear when, but having more use-cases for that certainly helps it being prioritized.
@dfelinto the rationales for using the new curves objects are indeed for attributes import, but also to not having to convert to a mesh as currently done for the legacy curves (which happens e.g. when saving files).
Ultimately, geometry sets do not work with the legacy curves, so not using the new object type means either postponing this patch, or revising the way the modifiers detect if geometry sets can be used; e.g. by having a callback on ModifierType which will take the decision based on the object type, and not relying on ModifierType.modify_geometry_set being non-null. Maybe there are other solutions.
We discussed this a little bit today at the weekly USD meeting and there was a desire to move forward with this patch for 4.1 as it still brings many benefits. For USD, as an example, this allows the Blender Hair demo files[1] to actually be imported without crashing (beveling the old curves creates too much geometry in main currently). It also opens the door for point instancing support in the not too distant future.
I think we can:
[1] https://www.blender.org/download/demo-files/#hair (The Animal Fur examples at least)
[2] Example Curves issues:
Spreadsheet view of what's going on. Notice how the more "correct" prototype actually turns out worse even though it matches what should be present.
@ -54,0 +52,4 @@
USDMeshReadParams /*params*/,
const char ** /*err_str*/) override
{
}
The
read_geometry()
function needs to have a non-empty body defined inusd_reader_shape.cc
to actually read the mesh, as below:Without this, the mesh won't animate if the USD shape has a time-varying property (such as size or radius).
I'll attach an example USDA of such an animation for testing in a separate comment.
Should be fixed now with the commit just pushed. I directly used your suggestion above which I confirmed still works.
As mentioned in my last comment, meshes generated for USD shapes with time-varying properties won't currently animate. I'm attaching an example USD of a capsule with an animating radius for testing.
I don't have additional comments regarding the USD changes, which look good to me, so I will approve this PR. (I agree that remaining issues with curves can be addressed in bcon 2 and 3.)
Also gets rid of #112308 then
I've updated this patch with my changes to address the alembic crash and fixing up some USD curve details.
For USD I needed to hand-craft files to test the various combinations of properties for linear and bezier curves (attached). Here is what things will look like.
Linear curves - Bottom to Top (Left side: Object with 1 curve. Right side: Object with 4 curves each of different size)
Non-periodic
,Constant
widthsNon-periodic
,Varying
widthsPeriodic
,Constant
widthsPeriodic
,Varying
widthsNote: The "constant" widths look "odd" due to not having a way to use an "even" profile when skinning the curve. Spreadsheet will show proper values.
Bezier curves - Bottom to Top (Left side: Object with 1 curve. Right side: Object with 4 curves each of different size)
Non-periodic
,Constant
widthsNon-periodic
,Varying
widthsNon-periodic
,Vertex Varying
widthsPeriodic
,Constant
widthsPeriodic
,Varying
widthsPeriodic
,Vertex Varying
widthsNote: Blender does not support
vertex-varying
-- we munge it to something close tovarying
instead.The latest commits look good to me!
The latest commits look good to me!
@blender-bot build
@blender-bot build
I did some tests : importing hair animation from Houdini in Alembic works great.
However, the hair imported in *.USD has a problem : there is a 90° rotation on it in X, and if i add some geo nodes hair modifiers like the interpolate hair, that dosen't work well. The hair dosen't stick to the source mesh.
I can't apply transformations neither because of the mesh sequence cache
@FrancoisRimasson If you believe you've found a bug, please open a new issue rather than comment on an already merged pull request.