Traversing hierarchy paths when reading alembic

64 views
Skip to first unread message

Amaan Akram

unread,
Jul 18, 2024, 7:22:05 AM7/18/24
to alembic-discussion
Hi everyone,

Looking for some advice on how to read in alembic hierarchies properly using the C++ API of with Alembic 1.8.3

We have a mesh that was opened and written out from houdini. After writing out from houdini, my own custom C++ alembic reader has switched the order in which it is traversing hierarchy paths, and changing the point order in the process. 

Houdini does not change the point order or the path traversal when I read the abc file back in, so I am assuming I am missing something fairly elementary in my importer. Code snippet is below, followed by the traversal pattern before the houdini-write out and after. Note the "L" and the "R" switch places

Would be great if someone can offer some advice here. 

Thank you
Amaan

Alembic::Abc::IArchive archive;
archive = Alembic::Abc::IArchive(Alembic::AbcCoreOgawa::ReadArchive(), fileName);
Alembic::Abc::IObject topObject(archive, Alembic::Abc::kTop);
ParseAlembic(topObject, crvProc, ID);

void ParseAlembic(const Alembic::Abc::IObject &parentObject, int depth = 0 )
{
    Alembic::Abc::ObjectHeader objectHeader = parentObject.getHeader();
    if (Alembic::AbcGeom::IPolyMesh::matches(objectHeader))
    {
        Alembic::AbcGeom::IPolyMesh mesh(parentObject, Alembic::Abc::kWrapExisting);
        printMsg("Ingesting Polymesh at @path = %s", parentObject.getFullName().c_str());
    }
    // Iterate through the children of the current object
    for (size_t i = 0; i < parentObject.getNumChildren(); ++i)
    {
        Alembic::Abc::IObject childObject(parentObject.getChild(i));
        ParseAlembic(childObject, depth + 1);
    }
}



Traversal path before houdini import and write out, using printMsg()

Ingesting Polymesh at @path = /Hat_GRP/R_pomPom_GRP/R_pomPomCenter_PLY/R_pomPomCenter_PLYShape 
Ingesting Polymesh at @path = /Hat_GRP/L_pomPom_GRP/L_pomPomCenter_PLY/L_pomPomCenter_PLYShape


Traversal path after houdini import and write out,  using printMsg()
Ingesting Polymesh at @path = /Hat_GRP/L_pomPom_GRP/L_pomPomCenter_PLY/L_pomPomCenter_PLYShape
Ingesting Polymesh at @path = /Hat_GRP/R_pomPom_GRP/R_pomPomCenter_PLY/R_pomPomCenter_PLYShape


Lucas Miller

unread,
Jul 18, 2024, 12:07:34 PM7/18/24
to alembic-d...@googlegroups.com
Your code looks correct.

I would try a test where you exported a handful of shapes with a shorter hierarchy path like and see how it goes into and comes out of Houdini:

/Hat_GRP/R_pomShape
/Hat_GRP/C_pomShape
/Hat_GRP/L_pomShape

I'd then move the order around  a few times (C, L, R)  (R,L, C)

I'm blindly guessing that it may be keeping things in alphabetical order internally hence why it looks the same going in and out.

Lucas

--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alembic-discussion/5d132091-f9dc-4c98-b61c-641309d32e27n%40googlegroups.com.

Amaan Akram

unread,
Jul 18, 2024, 1:31:21 PM7/18/24
to alembic-discussion
Hi Lucas

Thank you. I too suspect that there is some kind of sorting going on in houdini. I might end up doing the same in my importer too, as I am importing pairs of Polymeshes that need to match their hierarchy paths.

Cheers,
amaan

Amaan Akram

unread,
Jul 22, 2024, 9:56:12 AM7/22/24
to alembic-discussion
just to finish the conversation, houdini does indeed sort the incoming hierarchy in alphabetical order. 

I've taken that into account into my own alembic importer. Thanks, Lucas

Reply all
Reply to author
Forward
0 new messages