Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Alembic sampling

Discussion in 'Animation' started by Ookoohko, Mar 29, 2023.

  1. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    Hi,

    Not sure if this is the right forum for this question, but I'm trying to write an editor extension that samples Alembic animation vertex positions to a vertex animation texture.

    I've managed to import the alembic file successfully and I can mess around with the time in Alembic Stream Player manually, but for some reason I can't control the time position with a script.

    AlembicStreamPlayer seems to live in UnityEngine.Formats.Alembic namespace, but for whatever reason when I try to include the namespace ( using UnityEngine.Formats.Alembic.Importer; ) I get an error that says that type or namespace "Formats" does not exist in namespace 'UnityEngine'.

    What I don't understand is how can the plugin itself work, and the stream player also works fine.

    namespace UnityEngine.Formats.Alembic.Importer
    {
    /// <summary>
    /// This component allows data streaming from Alembic files. It updates children nodes (Meshes, Transforms, Cameras, etc.) to reflect the Alembic data at the given time.
    /// </summary>
    [ExecuteInEditMode]
    [DisallowMultipleComponent]
    public class AlembicStreamPlayer : MonoBehaviour, ISerializationCallbackReceiver
    {
    }

    How am I supposed to control this thing with code?

    I tried also adding the clip to a timeline and manually moving the timeline by setting PlayableDirector's time and calling Evaluate() , but that does not seem to change the actual vertex data at all.

    br,
    Sami
     
  2. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    (nevermind, it was a problem with broken asmdefs)
     
  3. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    393
    @Ookoohko
    Have you been able to bake it?
    I recall having a problem using editor code to access vertex positions using GetPosition.