Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Alembic sampling

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

  1. Ookoohko


    Sep 29, 2009

    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>
    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.

  2. Ookoohko


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


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