Exporting alembic from a c++ application / building a Maya 2012 plugin

920 views
Skip to first unread message

eight

unread,
Sep 4, 2012, 12:42:04 AM9/4/12
to alembic-d...@googlegroups.com
I just discovered Alembic, but haven't seen much documentation so I would appreciate any pointers in the directions I am working on:

1) I have a C++ program that exports a sequence of frames as Wavefront obj files in realtime (from kinect camera). It seems that a single alembic file would be a better option for this export. Is this true? Where would I start?

2) How can I build a Maya 2012 import plugin for alembic?

Thanks a lot.

--8

Steve LaVietes

unread,
Sep 4, 2012, 12:51:34 AM9/4/12
to alembic-d...@googlegroups.com

1) I have a C++ program that exports a sequence of frames as Wavefront obj files in realtime (from kinect camera). It seems that a single alembic file would be a better option for this export. Is this true? Where would I start?
Yes. Take a look at http://code.google.com/p/alembic/wiki/CookingWithAlembic for an example of writing an animated mesh from C++ 

2) How can I build a Maya 2012 import plugin for alembic?

Maya 2012 ships with pre-built Alembic plug-ins 00 -- so you may not need to.

-stevel
 

eight

unread,
Sep 4, 2012, 1:19:18 AM9/4/12
to alembic-d...@googlegroups.com
Ah, nice. Thanks a lot.

--8

Andrew Harvey

unread,
Sep 4, 2012, 4:34:52 AM9/4/12
to alembic-d...@googlegroups.com
Maya 2013 also comes with Autodesk's GPUCache plugin for displaying
detailed Alembic caches in the Maya viewport. The performance is
fantastic - models that bogged down Maya or even crashed it (as normal
Maya geo) can now be tumbled at double-digit frame rates. The source
code is provided too.

- Andrew
> --
>
>

eight

unread,
Sep 5, 2012, 9:57:34 AM9/5/12
to alembic-d...@googlegroups.com
Thanks, Andrew,

Loading Maya 2013 to try this out.

--8

eight

unread,
Sep 6, 2012, 1:12:13 PM9/6/12
to alembic-d...@googlegroups.com
Hello Steve,

I was able to somehow export my meshes with the example you pointed to (Example1_MeshOut), however when I read the created abc file in Maya 2013's cache, all I am seeing is a single frame. I guess the frame time information should be included into export as well. How that part is done?

Thanks..


--8

On Tuesday, September 4, 2012 12:51:38 AM UTC-4, Steve LaVietes wrote:

Lucas Miller

unread,
Sep 6, 2012, 1:22:18 PM9/6/12
to alembic-d...@googlegroups.com
I believe Maya 2013's gpu cache has options for exporting.

Otherwise you can do:
AbcExport -j "-root test -fr 10 100 -file /tmp/test.abc";

AbcExport -h;
will show you all the possible options as well as common examples.

Other common export examples can be found here:
http://code.google.com/p/alembic/wiki/MayaAbcExportAbcImportNotes

Lucas

--
 
 

eight

unread,
Sep 6, 2012, 2:01:58 PM9/6/12
to alembic-d...@googlegroups.com
Let me clarify: I am exporting from a custom C++ application, and am importing into Maya. For import in Maya, there is no options, as far as I could see. I believe the time information must be baked into abc file by the exporting c++ app. How is this done?

Thanks a lot!

--8

eight

unread,
Sep 6, 2012, 8:13:05 PM9/6/12
to alembic-d...@googlegroups.com
Found what I was looking for. An example that incorporates time into animation in PolyMeshTest.cpp

void meshUnderXformOut( const std::string &iName ){

    OArchive archive( Alembic::AbcCoreHDF5::WriteArchive(), iName );

    TimeSamplingPtr ts( new TimeSampling( 1.0 / 24.0, 0.0 ) );

    OXform xfobj( archive.getTop(), "xf", ts );

    OPolyMesh meshobj( xfobj, "mesh", ts );

    OPolyMeshSchema::Sample mesh_samp(

        V3fArraySample( ( const V3f * )g_verts, g_numVerts ),

        Int32ArraySample( g_indices, g_numIndices ),

        Int32ArraySample( g_counts, g_numCounts ) );

    XformSample xf_samp;

    XformOp rotOp( kRotateYOperation );

    Box3d childBounds;

    childBounds.makeEmpty();

    childBounds.extendBy( V3d( 1.0, 1.0, 1.0 ) );

    childBounds.extendBy( V3d( -1.0, -1.0, -1.0 ) );

    xf_samp.setChildBounds( childBounds );

    double rotation = 0.0;

    for ( std::size_t i = 0 ; i < 100 ; ++i ){

        xf_samp.addOp( rotOp, rotation );

        xfobj.getSchema().set( xf_samp );

        meshobj.getSchema().set( mesh_samp );

        rotation += 30.0;

    }

}

Peace.

--8
Reply all
Reply to author
Forward
0 new messages