com.unity.formats.alembic icon indicating copy to clipboard operation
com.unity.formats.alembic copied to clipboard

How to get the alembic vertex position data in C# code

Open stranger-games opened this issue 2 years ago • 0 comments

Hi,

I want to write a custom script and shader that would use position data of an object from alembic file.

I believe that the plugin currently won't allow me to directly access the data I need. Almost all classes are private to the package except the stream player.

I imagine I would need access to AlembicStreamDescriptor and would implement a custom version of AlembicStream.

A more involved solution would be to have a more generic version of AlembicStream with the current AlembicStream using it. That would help greatly with custom implementations for anyone interested.

I imagine the generic AlembicStream will have something like this

    void AbcBeginSyncData(AlembicTreeNode node)
    {
        if (node != null && node.abcObject != null && node.gameObject != null)
            listener.AbcSyncDataBegin(node);//node.abcObject can be null with the generic alembic stream. We can have an enum AlembicTreeNode.AlembicElementType (mesh or points, etc..) and the listener should have somehow access to the vertex, uv, .. data of that node to do its processing
        foreach (var child in node.Children)
            AbcBeginSyncData(child);
    }

    void AbcEndSyncData(AlembicTreeNode node)
    {
        if (node.abcObject != null && node.gameObject != null)
            listener.AbcSyncDataEnd(node);
        foreach (var child in node.Children)
            AbcEndSyncData(child);
    }

Thanks for advance.

stranger-games avatar Apr 15 '22 12:04 stranger-games