Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Alembic for Unity

Discussion in 'Editor Workflows' started by ans_unity, Mar 13, 2018.

  1. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    137
  2. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    74
    Hey @Panogramma3d,

    Would you mind opening a new thread in Editor Workflows forum, tag it with Alembic tag and add :
    - Unity version
    - OS version
    - Alembic Package version
    - a sample .ma and .abc with reproduction steps

    So we can investigate this further.

    Thanks a lot !
     
  3. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Hey,

    Thanks for your reply.
    I tried yesterday and you should be able to make standalone builds for OSX and Windows with Alembic enabled. Does Vuforia work on these platforms or it's an iOS thing ?
     
  4. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Hello Good Alembic Folk,

    Alembic 1.0.0 has been officially released on Package Manager. This is the first Verified Package release of the plugin. It is compatible with Unity 2018.3.4 and onwards.

    Please note the Alembic Recorder Track has been removed from the package as we plan to distribute it differently. Let us know if this is an immediate problem for you.

    To install the new version :
    * Open Package Manager UI and install or update the package :

    Screen Shot 2019-02-25 at 11.46.46 AM.png

    New

    * General cleanup

    Fixed

    * AlembicShotClip registers the time property of the AlembicStreamPlayer as driven so timeline changes to the scene are not persistent
    * Fix Scene bloating: Meshes generated by the AlembicStreamPlayer are not serialized with the Scene

    Known Issues

    * The first time the Alembic package is used in a project, the shaders shipped with it need to be reimported, or else all Alembic imports will fail.
     
  5. SKoptev

    SKoptev

    Joined:
    Jan 15, 2019
    Posts:
    24
    Hello!
    Which version of HDRP is needed for "Shaders/HD/LitAlembic" shader?
    Error "Shader is not supported on this GPU (none of sunshaders/fallbacks are suitable)" appears, reimport not help.

    Also, there is some small bugfixes:
    1. Default scale factor should be 1.0 (instead of 0.01).
    AbcAPI.cs : Ln 102
    AlembicSettings.cs : Ln 42

    2. When alembic clip created, it should be named properly
    AlembicShotAsset.cs, Ln.39, add:

    if ( m_stream )
    name = "AlembicShotAsset_" + owner.name + '_' + m_stream.name;


    3. Alembic clip duration needs to be set after CreatePLayable (to prevent press "Match content" every time by hands).
    AlembicTrack.cs : Ln13

    Code (CSharp):
    1.     public class AlembicTrack : TrackAsset
    2.     {
    3.         protected override Playable CreatePlayable(PlayableGraph graph, GameObject gameObject, TimelineClip clip)
    4.         {
    5.             var playable = base.CreatePlayable(graph, gameObject, clip);
    6.  
    7.             var alembicShotPlayable = (ScriptPlayable<AlembicShotPlayable>)playable;
    8.             clip.duration = alembicShotPlayable.GetBehaviour().streamPlayer.duration;
    9.  
    10.             return playable;
    11.         }
    12.     }
    Thanks!
     
    Last edited: Mar 5, 2019
  6. R_lapham

    R_lapham

    Joined:
    Jun 3, 2018
    Posts:
    3
    This would be incredible. Would it be possible to load an alembic file on iOS from a CMS?

    Currently I'm getting these errors:
    The referenced script (UnityEngine.Formats.Alembic.Timeline.AlembicTrack) on this Behaviour is missing!

    A script behaviour (probably UnityEngine.Formats.Alembic.Timeline.AlembicShotAsset?) has a different serialization layout when loading. (Read 48 bytes but expected 68 bytes)


    In other words, would it be possible to reference these scripts after building to iOS? The serialization seems like another major roadblock. I'm pretty invested and happy to work on it with a little guidance.

    edit: sp
     
  7. WI_Spas

    WI_Spas

    Joined:
    May 11, 2018
    Posts:
    3
    Is there a plan in place for console (Xbox/PS4) Plugin distribution, even if its a thread on the relevant forums or at some help or a guide for those of us who haven't built a Plugin like this for consoles before?

    Either would be greatly appreciated!
     
  8. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Thanks. I tested with HDRP 5.2.3 and 4.1.0 and it is compatible. Which version of HDRP/Unity are you using?
    Thanks for the fixes.

    Will look at 1), 2)
    Unfortunately 3), is incompatible with the philosophy of Unity: you should not change data when you build playableGraphs. This has been a longstanding issue for Timeline and they will implement an API to specify duration properly.
     
    Last edited: Mar 6, 2019
  9. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    You are getting those errors on iOS I imagine?
    Unfortunately I don't think we'll add iOS support for Alembic anytime soon: it's a fairly inefficient format and porting the native code to a new platform is fairly involved.
    The way forward is to convert Alembics into some form of Unity native point cache. This is a long term plan.
     
  10. SKoptev

    SKoptev

    Joined:
    Jan 15, 2019
    Posts:
    24
    Thanks a lot for your answer!
    I'm using Unity 2018.3.2f1 && HDRP 4.10.0. Nvidia GeForce GTX 1050 Ti, driver ver. 418.81 (upd.: 419.35 - nothing changed).
    There are problems not only with "LitAlembic" shader ("shader is not supported on this GPU"), but also with "Standart roughness" (same error).

    Also, Unity 2019.2.0a6 + HDRP 6.4.0: the error remains.
     
    Last edited: Mar 7, 2019
  11. R_lapham

    R_lapham

    Joined:
    Jun 3, 2018
    Posts:
    3
    Thanks for your reply. It is on iOS yes, in the Xcode log.
    I'm sure it is involved to build out, does it help at all that iOS supports alembic animations? I know building from Unreal works on iOS. With Quill animations saved as alembic, it would open a whole world to AR devs bringing 3D paintings into AR. - let me know if there's anything I could try.
     
  12. kong_unity

    kong_unity

    Joined:
    Feb 14, 2019
    Posts:
    6
    Hey guys, is this normal ? 140fps vs 2fps, all the fault is alembic update, and it skyrocket the cpu from using 7.5ms
    to 530ms, is alembic this cpu intensive or did i do something wrong ?
    i'm using alembic for character in timeline.
    if the calculation is just too much can we leave it for the gpu to do ?

    unity 2018.3.7f1
    alembic 1.0.0
    without and with alembic update
    140 fps vs 2fps
    cpu 7.5ms vs 530ms
     
    Last edited: Mar 13, 2019
  13. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Alembic as a format is not very efficient and I am sure our implementation is suboptimal itself. From the top of my head, 500MS for an Alembic update feels like a lot.
    If you'd like me to take a look at it, you'll have to send me the file.
     
  14. kong_unity

    kong_unity

    Joined:
    Feb 14, 2019
    Posts:
    6
    thanky you, the file is company project's so i'll get back to you on monday.
    i cant give u the file but when i got to office i'll give info about vertex count, how i export from maya, and total gameobject of the hierachy.
    for now, what i plan to do is try reexport with different setting, remove gameobject with no mesh. If that doesnt workout i'll try cache the mesh's vertex position each alembic frame update to array and update it by myself.
    If u have any tips about optimize maya-unity workflow pls tell me, thank you very much!
     
  15. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Great. I would love to get some numbers if you can.
     
  16. kong_unity

    kong_unity

    Joined:
    Feb 14, 2019
    Posts:
    6
    I got it now, because i do it the wrong way. hope people find this useful for making ingame cutscene.
    i'm using this workflow for the company's trailer.
    btw side question,the img url i post in google photo last time got broken, i post it by open it,right click and
    copy image url. Is the img url has short lifetime so it will broken again in the future ?

     
  17. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Awesome :)
     
  18. jonosmars

    jonosmars

    Joined:
    Dec 12, 2018
    Posts:
    5
    So I have a unity system working for desktop with alembic. It doesn't work on the oculus go however. There's nothing to see once build? is it not supported for android?

    ta
     
    Last edited: Mar 21, 2019
  19. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Only Desktop platforms are supported.
     
  20. Rayeloy

    Rayeloy

    Joined:
    Feb 12, 2017
    Posts:
    23
    Hello, I was wondering If there was any way to control the alembic animation in code. I need it to play/stop when the player collides with a trigger. I also need to control when does it start and finish, and even do it backwards. Is that possible? The only class I've seen that can do that is the AlembicStreamPlayer with the "time" variable from the editor, but it is an internal class and I can't access it. What can I do?

    Thank you
     
    olix4242 likes this.
  21. kong_unity

    kong_unity

    Joined:
    Feb 14, 2019
    Posts:
    6
    u can use reflection in the mean time.
     
  22. Rayeloy

    Rayeloy

    Joined:
    Feb 12, 2017
    Posts:
    23
    Thank you for answering :) May I know what is "reflection" ? Does your answer mean there is no way to control alembics from code yet?
     
  23. KongGameArtist

    KongGameArtist

    Joined:
    Feb 1, 2019
    Posts:
    10
    Rayeloy likes this.
  24. xna-krsn

    xna-krsn

    Joined:
    Jan 10, 2014
    Posts:
    1
    Goodness me, use reflection to wrap Alembic functionality in runtime... it's not a good idea. Actually, it would be better to clone AlembicForUnity repo.
    Unity team, why don't you expose full API in the package?
     
    olix4242 likes this.
  25. kyip2

    kyip2

    Joined:
    Jul 10, 2018
    Posts:
    12
    In your playable director for the alembic animation you need to change the Update Method to manual and turn off Play On Awake. In a C# script define a Playable Director variable. For example:

    public class TestAlembicAnim {
    public PlayableDirector playableDirector;

    void Update() {
    playableDirector.time = 0.0;
    }
    }

    And in the Unity inspector assign your playable directory for the animation to it. I've set playableDirector.time to 0.0. In reality you need to set it to where in the animation you want to be. If you don't change it every update loop then it will sit still. Through the time variable you can pause, play, rewind, fast-forward etc the animation simply by changing that variable.

    Hope that helps.

    Kam.


    upload_2019-3-27_12-25-21.png
     
  26. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Thanks for the message
    The public API is coming. We were forced to make it internal because all public API needs to be tested and documented properly. Once this is done, the API will be opened up.
     
    xna-krsn likes this.
  27. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    You might have stumbled across some compilation pipeline bug who's fix did not land in 2018.3 just yet. The usual fix is to force a recompilation of the package (Right click on Alembic in the ProjectWindow and reimport). If that does not fix it, try deleting the Library/PackageCache, it will be regenerated next time you restart unity.
    Sorry for the inconvenience :).
     
  28. Gavert

    Gavert

    Joined:
    Jan 31, 2017
    Posts:
    12
    I have a question:

    Lets say that I have a rough stiff animation imported to Unity. I enhance it with stuff like Jiggle, Dynamic Bones, Final IK to add wind/gravity/fluid jiggle movement. If I were to then export the animation as an alembic file, would the animation be exported in its basic form or would it include the effects added by scripts mentioned above.

    or to simplify the question further. If I were to export this kind of scene:


    Would it export the block figure on the left or the middle/right ones?
     
  29. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    While I have not checked it myself, I'd imagine all your extra processing would be included in the exported mesh if those scripts run before the alembic exporter. The exporter captures the final mesh(vertices, normals, UVs, etc)
     
  30. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Maybe a bit late....
    The current version of the alembic provides 2 Animation clips: one with an AnimationEvent for every time frame the Alembic is active and another one with a time curve. Are these the clips you expected?
     
  31. KongGameArtist

    KongGameArtist

    Joined:
    Feb 1, 2019
    Posts:
    10
    Thanks for the answer, it's not a bug, maybe a misleading error.
    it happen because i add the component to a empty gameobject, and it confuse me since it looks like a error.
    but if i just drag the alembic file imported to unity, it will have the component and no error.
    dev team can consider to remove the error message for empty gameobject, thanks.
     
  32. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    Hello,

    I would like to announce the release of Alembic version 1.0.3. This 2 major bug fixes:
    * Standalone builds are now supported on Windows and OSX: all prefab instances point to the alembic assets copied into the StreamingAssets of the app.
    * Fixed an issue where if Alembics were used in an active Scene, all write operations on these assets would fail on Windows (CVS updates, etc)

    For all full list of changes please look at the Changelog

    On a related note, the Film-TV toolbox package has been released and contains a Material Remapping tool to facilitate the material management for meshes. For a full doc, please see: https://docs.unity3d.com/Packages/com.unity.film-tv.toolbox@0.1/manual/index.html
     
    Rayeloy likes this.
  33. Ben-Kuper

    Ben-Kuper

    Joined:
    Aug 31, 2012
    Posts:
    16
    Thank you @vladala !
    Any idea when public API is coming ? It's a bit constraining not to be able to control AlembicStreamPlayer from another script.
    I had created an AlembicStreamController which only exposes few properties from AlembicStreamPlayer so it's available from outside the package, but somehow it got deleted when I reopened the project, because the file was inside the PackageCache folder.
     
  34. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    40
    The public api will come in the future. Unfortunately I cannot give you a date, as I need to fix all the relevant bugs before I can deal with the public API.
    If the API is something that bothers you a lot today, you can fork the repo and make your manifest point directly to your copy (think this is 2019.1 package feature). This way you can integrate my fixes in your fork.
     
    Rayeloy likes this.
  35. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    74
    Hey there,

    Alembic 1.0.5
    has been published on production.
    It fixes a regression introduced in 1.0.4 version where old Alembic scene instances would lose prefab connection.

    /!\ If you installed 1.0.4 AND are encountering issues with upgrading to 1.0.5, please create a new post, tag it with Alembic tag so we can help you on a case by case basis.
    The transition between 1.0.3 and 1.0.5 should be seamless.

    That said here's what 1.0.4 version fixed (still valid in 1.0.5) :
    • Fixed crash in the Exporter when using SwapFaces
    • Fixed Branch recording mode in the Exporter
    • Fixed Scene references being lost, when alembic prefab was being renamed
    • Fixed initial import of Alembic files when both the alembic Package and assets are imported at the same time
    • Fixed regression, where absolute paths to alembic assets were stored
    • Alembic importer and Exporter correctly deals with physical Camera parameters
    Thanks for your patience and sorry about the regression !
     
    Rayeloy likes this.
  36. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    74
    Hey there,

    *Alembic Material Remapper* has been released as part of Film-TV-toolbox 0.2.0-preview.1 package.
    It's a component that allows to use a target game object (an fbx for example) as the 'lookdev' material source for all materials of an Alembic.

    See doc : https://github.com/Unity-Technologies/film-tv-toolbox/blob/master/com.unity.film-tv.toolbox/Documentation~/alembic-material-mapper.md

    To install the Film-TV-toolbox package, open package manager (Window > Package Manager), enable preview packages (in “Advanced” options), search for Film-tv-toolbox and click the install button.

    Let us know if you have any questions.
     
    Rayeloy likes this.
  37. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,357
    I came across one (big for me) problem with Alembic Playable and Timeline.
    For my Unity plugin for rendering, Deckard, I have to use PlayableDirector.Evaluate();
    This functionality instructs Timeline to update all animations on Timeline and can be used to render multiple animation time positions (time scrolling) in one single Update().
    Unfortunately, Alembic animation doesn't follow this rule, and gets updated only once per frame (Update())
    As we don't have API, we cant even call Update() on alembic.

    p. s. This functionality is essential for Deckards motion blur that uses Multisampling, that gets rendered by rendering multiple frames with different time states.
     
  38. Rayeloy

    Rayeloy

    Joined:
    Feb 12, 2017
    Posts:
    23
    After playing a bit with alembics, I found out that they consume quite a lot of resources, to the point where they lower my fps by 50 or more just by having some of them in the scene playing. This makes them unviable for game developing. My question is: will there be any improvement in efficiency or in regard of their possible use in games?
     
    Last edited: Jun 13, 2019 at 9:26 AM
  39. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    74
    Hey @Rayeloy,

    Alembic format is indeed not the best for performance.
    There are general best practices that can help with that in Unity, though.
    Example :
    * make sure Alembic assets are shallow
    * make each Alembic asset a top-level GameObject (having a single parent)
    * flatten the rigs

    Disk IO is almost always the bottleneck so having good SSD or RAM disk could help.

    On our side, using an alternative vertex cache for the runtime is something we have on the roadmap.

    Thanks for your feedback !
     
    Rayeloy likes this.
  40. WillianPGermano

    WillianPGermano

    Joined:
    Apr 12, 2018
    Posts:
    1
    Hi,

    For the project I'm working on, artists need to import Alembic files that include metadata.

    I didn't find support for loading this information in the Unity Alembic plugin, either as Abc::MetaData or string / array of strings saved as user properties.

    Is it already possible? Case so, please point me in the right direction. Case not, can it be added at least for importing? Being able to also export it would be even better, for sure.

    I wrote a quick test importing metadata from the top object, worked fine:

    This is how I exported it from aiContext.cpp:

    Code (C++):
    1. const char* aiContext::getTopObjectMetaData()
    2. {
    3.     abcObject& top = m_top_node.get()->getAbcObject();
    4.     std::string mds = top.getMetaData().serialize();
    5.     char* cstr = new char[mds.length() + 1];
    6.     std::strcpy(cstr, mds.c_str());
    7.     return cstr;
    8. }
    Then got it in AlembicStream.cs upon loading the model:

    Code (CSharp):
    1.         public void AbcGetMetaData()
    2.         {
    3.             m_metadata = new List<KeyValuePair<string, string>>();
    4.             string[] md_entries = m_context.topObjectMetaData.Split(';');
    5.  
    6.             foreach (string entry in md_entries)
    7.             {
    8.                 string[] kv = entry.Split('=');
    9.                 m_metadata.Add(new KeyValuePair<string, string>(kv[0], kv[1]));
    10.             }
    11.         }
    Just a simple test.

    Thanks for this plugin!
     
  41. SozoDev

    SozoDev

    Joined:
    Nov 15, 2016
    Posts:
    6
    I'm reading the docs and forums but can't quite get a definitive answer to the following: Is the Alembic format supported on Android and iOS?

    Here is my use case: I have a baked cloth animation I want to get working on mobile. What would the best format be if Alembic isn't supported?