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

Alembic for Unity

Discussion in 'Asset Importing & Exporting' started by ans_unity, Mar 13, 2018.

Thread Status:
Not open for further replies.
  1. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey,
    Thanks for the reply. The vertex color should be streamed, but you'd need a custom shader to get access to this information. An example:
    Code (CSharp):
    1. Shader "Debug/Vertex color"
    2. {
    3.    SubShader
    4.    {  
    5.       Pass
    6.       {      
    7.          CGPROGRAM      
    8.          #pragma vertex vert      
    9.          #pragma fragment frag      
    10.          #include "UnityCG.cginc"      
    11.          // vertex input: position, color      
    12.          struct appdata {          
    13.             float4 vertex : POSITION;          
    14.             fixed4 color : COLOR;      
    15.             };      
    16.          struct v2f {          
    17.          float4 pos : SV_POSITION;          
    18.          fixed4 color : COLOR;      
    19.          };      
    20.  
    21.          v2f vert (appdata v)
    22.          {          
    23.              v2f o;          
    24.              o.pos = UnityObjectToClipPos(v.vertex );          
    25.              o.color = v.color;          
    26.              return o;      
    27.          }      
    28.  
    29.          fixed4 frag (v2f i) : SV_Target
    30.          {
    31.             return i.color;
    32.            
    33.          }      
    34.          ENDCG    }}}
    35.  
    The other texcoords have special semantics inside the unity materials (eg: texcoord4 is for velocity of motion vectors, etc). The current implementation sends only the minimum set of info.
     
    SKoptev likes this.
  2. Noors84

    Noors84

    Joined:
    Jul 12, 2016
    Posts:
    78
    Hello there. I'm trying to export a default shuriken particle system from Unity to Alembic without luck.
    Using 1.0.5, I do not see the checkbox "Capture Components / Particle System ".
    Using github version,i see the checkbox, but it doesnt work either..
    Changing billboards to mesh doesnt change anything.
    If it should work, please what is the procedure?
    Thanks

    Works within Unity with "Entire scene" instead of "Target branch", but i can't import correctlyin 3d Max as i guess the particle mesh is not exported.
     
    Last edited: Aug 19, 2019
  3. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey,

    Thanks for the message.
    The GitHub version was not working as you noticed and when we moved to the package system it got removed.
    I will add it to road map, and see if it can get scheduled at some point (no promises :) )
     
  4. WI_Spas

    WI_Spas

    Joined:
    May 11, 2018
    Posts:
    9
    Any news regarding console support for those who haven't managed to build the plugin on their own?
     
  5. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    I an using Unity 2019.1.14f1 and alembic version 1.0.5 via the package manager. My alembic animations via the animation stream work fine in the editor, but don't show up in standalone builds on Windows. The abc files should be copied into the StreamingAssets folder of the build, but aren't. Manually copying them in does not seem to work.

    Do I need to do something to make this work or might this be a bug?

    Edit: turns out i has exported from Maya with default settings. Re-exporting with the advised settings from the documentation made it work.
     
    Last edited: Sep 5, 2019
  6. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey,

    I am not sure there are any plans to provide Alembic for other platforms then the editor ones. The only work in progress is for Linux.

    Vlad
     
  7. WI_Spas

    WI_Spas

    Joined:
    May 11, 2018
    Posts:
    9
    Thank you for the reply!

    That's unfortunate, we were looking forward to potentially using Alembic but since we're releasing on PS4/Xbox we'll be avoiding until there's hopefully support for it at a later date!
     
  8. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Hi there,

    Currently having issues with Alembic files in Unity. Occasionally they seem to be losing their connection to their 'stream descriptor'. See below -
    upload_2019-10-8_16-38-6.png
    I can fix this temporarily by dragging in a new copy of the prefab and copying the Stream Player from the new copy to the gameObject with problems, moving the copied component up to the top of the Inspector stack and the removing the old, broken Alembic Stream Player... but then I get the following error while attempting (and failing) to build my project:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Formats.Alembic.Importer.AlembicStream.UpdateAbcTree (UnityEngine.Formats.Alembic.Sdk.aiContext ctx, UnityEngine.Formats.Alembic.Importer.AlembicTreeNode node, System.Double time, System.Boolean createMissingNodes, System.Boolean initialImport) (at Library/PackageCache/com.unity.formats.alembic@1.0.5/Runtime/Scripts/Importer/AlembicStream.cs:194)
    3. UnityEngine.Formats.Alembic.Importer.AlembicStream.AbcLoad (System.Boolean createMissingNodes, System.Boolean initialImport) (at Library/PackageCache/com.unity.formats.alembic@1.0.5/Runtime/Scripts/Importer/AlembicStream.cs:144)
    4. UnityEngine.Formats.Alembic.Importer.AlembicStreamPlayer.LoadStream (System.Boolean createMissingNodes) (at Library/PackageCache/com.unity.formats.alembic@1.0.5/Runtime/Scripts/Importer/AlembicStreamPlayer.cs:75)
    5. UnityEngine.Formats.Alembic.Importer.AlembicStreamPlayer.OnEnable () (at Library/PackageCache/com.unity.formats.alembic@1.0.5/Runtime/Scripts/Importer/AlembicStreamPlayer.cs:137)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Can anybody help me out with this? It's a serious show-stopper, and we're scheduled to ship shortly.

    Thanks in advance,

    --Rev
     
  9. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey,

    Sorry to hear about your issues. What unity/package versions are you using ?

    I have not seen this issue in a very long time. When I did see it before it was due to one of 2 things:
    Package infrastructure failure or dll import issues of alembic package code: In this case reimporting the alembic package or deleting the Library did the job.
    There used to be some bugs that caused prefab instances to become broken when renaming the imported alembic file inside the project. One bug was fixed in version 1.0.5 and another was fixed in 1.0.6 (released this morning).

    If you can provide more info with some repro steps I would be glad to look at them.
     
  10. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey guys,

    Alembic 1.0.6 has been published on production.
    A short list of fixed:
    * Added support for Linux (does not support HDF5)
    * Fixed incorrect normal calculation when the UVs were split
    * Fixed lost references to the scene GameObject when renaming the alembic asset
    * Fixed the LitAlembic material compatibility with HDRP 4.10 (latest 2018.4 version). For 2019.2+ HDRP standard materials support vertex motion vectors
    * Fixed Vertex colour import from Houdini.
    * Fixed a case where Alembic files were not copied in player builds if they were initially disabled
     
  11. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    142
    Dear dev contributors,

    A quick note to let you know that the AlembicForUnity git repository has been moved to Unity-Technologies organisation.
    See: https://github.com/Unity-Technologies/AlembicForUnity

    This is a simple move, all issues / PRs / Watchers / Stars... have been preserved.

    If some of you have a local clone, please update your origin URL:
    git remote set-url origin git@github.com:Unity-Technologies/AlembicForUnity.git


    Thanks !
     
    Code_Vianney likes this.
  12. mcyber4

    mcyber4

    Joined:
    Oct 24, 2019
    Posts:
    14
    Tried to install with packagemanager but get an error alike:"cloth not found"
    Thanks for fixing.
     
  13. Export2019

    Export2019

    Joined:
    Nov 2, 2017
    Posts:
    3
    I can't import that alembic(.abc) file exported with CINEMA4D R21.
    Attached a simple file exported by C4D R21. And the particles gif movie.
    This abc file(alembic1.zip) can reproduce the error.I tried to import with Unity 2017,2018,2019,
    and alembic asset 1.0.0preciew11-v1.06 but all Unity were downed.(C4D R21 can reimport this file.)

    If there are the solution strategy for import, please tell me.
    Or else, please fix the asset.thanks.

    1.abc.gif
     

    Attached Files:

  14. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    142
    Hi @mcyber4,

    Just gave a try on Unity 2019.2.12f1 and Alembic 1.0.6 on Windows 10, with no issue.

    A first step is to make sure you are using the last "patch" version (especially if you are using 2019.3 beta or 2020.1 alpha).
    Another would be to test in an empty project.

    If that does not help, please provide more details :
    - Unity version
    - Alembic version
    - OS version
    - Full error log
    - Other big dependencies and versions

    Thanks !
     
  15. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    Hi @Export2019,

    To import Alembic point clouds (particles) in Unity, select your Alembic asset and enable the "Import Points" options in the Inspector window. Then "Apply" the settings to re-import your asset and you should have your particles.

    Let us know if that still doesn't work for you.

    Cheers!
     

    Attached Files:

  16. Export2019

    Export2019

    Joined:
    Nov 2, 2017
    Posts:
    3
    Hi thanks reply.
    Wow Can you open this file?? great!
    What Unity & alembic asset version did you use? My main unity is "Unity2018.4.4f1" & 1.0.6.
    When abc file put in assets folder, my Unity2018 is always downed.
    I never can edit the alembic setting.
     
  17. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    @Export2019 that's weird, it's working on my end with those versions (Unity 2018.4.4f1 and Alembic package 1.0.6). Could you try again from a new project and see if you still get the the problem?

    Also, what exactly happens when Unity is "downed"? Do you get an error in the console or the Editor closes/crashes?

    Thanks
     
  18. Export2019

    Export2019

    Joined:
    Nov 2, 2017
    Posts:
    3

    @cguertin thanks reply
    I continued to try.
    and I could check the Import Ponts while got to crash 2 times.
    but abc file doesn't work...

    02:20 crash
    03:14 crash
    can't D&D in scene and hierarchy
    (and crashed by menu > Assets > reimport )

    attached a mp4 movie.

    and console message
    A default asset was created for 'Assets/1.abc' because the asset importer crashed on it last time.
    You can select the asset and use the 'Assets -> Reimport' menu command to try importing it again, or you can replace the asset and it will auto import again.

    what cause do you see? I don't know what to do.
     

    Attached Files:

  19. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey guys,

    Alembic 2.0.0-preview.1 has been published on production.
    A short list of fixed:
    • Minimum Unity version is 2019.3.
    • Introduced public API for Alembic playback and recording.
    • Loading of Alembic files is now multi-threaded.
    • Removed the LitAlembic HDRP shader that has been obsoleted by HDRP native shaders that now offers the once missing velocity option.
    • HDF5 format is Obsolete.
    • Fixed a bug where the face-id were being sorted in ascending order.
    • Fixed a bug that caused crashes when importing point clouds that had no velocity information.
    • Fixed a bug that caused exported geometries to have too many triangles
     
    gnoviawan, markvi and Johannski like this.
  20. gnoviawan

    gnoviawan

    Joined:
    Mar 9, 2017
    Posts:
    3
    Thank you for the 2.0 preview.
    is it now able to load/stream alembic file from outside unity project folder without import the alembic data ?
     
    Last edited: Jan 14, 2020
  21. zeekindustries

    zeekindustries

    Joined:
    Jun 4, 2010
    Posts:
    19
    Hey guys!

    We are trying to bring multiple UV sets, 4 to be precise, based on the fact that ShaderGraph can access up to 4 channels, but we just run into the issue that the ABC importer will only read the first 2, would it be possible to add support for the extra two UV sets?
    I tried manually modifying the AbcAPI.cs and AlembicMesh.cs thinking that it would be just a matter to have the importer fetch the data from the Abc and create it, but turned out to be not as simple as that.
    Any help on this matter will be greatly appreciated :D
     
  22. ScaVPC

    ScaVPC

    Joined:
    Feb 19, 2017
    Posts:
    3
    I have an issue.

    My alembic animation doesn't seem to be in sync.

    For example, if the movement is fast, the eyes of my character will literally pop out of the characters' faces, but the same alembic file works as expected in Max.

    Now I'm wondering since I saw a few things, does alembic import on unity smooth out some curves or something?

    When I'd expand the alembic file, in the _frames I'd see in inspector debug that it's 60fps (I export it @ 30) and the High Quality curve is ticked on?

    How do we go about changing this?

    https://drive.google.com/file/d/1Md5WAFlk5yb9XRpCdyCQF8rkeVnSr9Wc/view


    EDIT: I found out this desync happens when scaling bones in my character
     
    Last edited: Feb 5, 2020
  23. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    Hey @gnoviawan, it isn't currently exposed in the interface but you can indeed load alembic files outside the project folder via script in the latest version of the package (2.0.0-preview.1)!

    I've attached an example script that should point you in the right direction. It adds a new menu item to let you browse for an alembic file and create a new GameObject from it with. Let me know if you have any questions!
     

    Attached Files:

    GeniusKoala and gnoviawan like this.
  24. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    Hey @ScaVPC, I just want to confirm a few things with you:
    1 - Is your whole character imported as Alembic into Unity or only parts of it?
    2 - When you mention bone scaling, you are doing this scaling in Max before exporting the Alembic files?

    Would it also be possible to send me your alembic file so that I can try reproducing on my end? (you can send it via direct message if you prefer)
     
  25. gnoviawan

    gnoviawan

    Joined:
    Mar 9, 2017
    Posts:
    3
    Thank you so much! this what i looking for!
    now our unity project didn't have to import or duplicate the alembic from our server, currently we try to integrate Unity in our tv animation pipeline.
    and now will try modify your script to match with our pipeline and more Artist friendly!
    again, thank you so much for developing this plugin.
     
    cguertin likes this.
  26. ScaVPC

    ScaVPC

    Joined:
    Feb 19, 2017
    Posts:
    3

    We export a single alembic file, but the model itself has eyes on separate joints, the eyes don't get merged with the mesh.

    I'll see if I can export a short sample of animation and you can test it out, we are scaling bones in 3ds max making the full anim, and then exporting into unity.
     
  27. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    The "desync" you are seeing here is actually the interpolation between the Alembic samples. Your file was exported at 30fps (generating 30 alembic time samples per second) and if you position your timeline cursor between two time samples, Unity will try to interpolate the position of vertices between the two.

    If you are curious, this behavior is also visible in 3dsMax:
    1 - Create a new 3DS Max scene and import the alembic you are using in Unity
    2 - Change the scene's fps to 60
    3 - Move to frame 179 and you'll notice that the eyes are "popping out" of the character's head like in Unity.

    For your case I would suggest disabling the automatic interpolation which will force Unity to only display the vertex positions on the exact alembic time samples. You can do this by selecting your Alembic asset in your project and uncheck "Interpolate Samples" in the inspector. Then select "apply" in the Inspector to re-import the asset with the new settings.

    Let us know if you have any more questions!
     
  28. Juang3d

    Juang3d

    Joined:
    Sep 25, 2012
    Posts:
    87
  29. ScaVPC

    ScaVPC

    Joined:
    Feb 19, 2017
    Posts:
    3
    This did not resolve the issue, disabling interpolation produces still the same result as before
     
  30. Phatage13

    Phatage13

    Joined:
    Nov 13, 2015
    Posts:
    5
    Looking to push Alembic files to the HoloLens2, which uses an ARM processor. Is there any plans for deploying the plugin dll for ARM in addition to x86_64?
     
  31. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    Hey @Phatage13! We don't have any plans at the moment to support Alembic on the HoloLens2. Our roadmap may change with time but at the moment we are focusing on Windows, MacOS, and Linux support.

    Cheers!
     
  32. shangqm

    shangqm

    Joined:
    Feb 22, 2019
    Posts:
    4
    I want to use this on Android,please,please,please,please,please...:(
     
  33. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    Please, any news on this?
    I really need ability to update manually alembic Stream Player.
    Now that Timeline has Alembic Track, it should be default behaviour to update alembic animation state on calling
    Code (CSharp):
    1. playableDirector.Evaluate();
    Right now Alembic Stream Player updates only once per frame. But an ability to update more times via timeline is essential also for consistency reasons.

     
  34. max_coding13

    max_coding13

    Joined:
    Apr 24, 2016
    Posts:
    34
    I'm having an issue where Alembic models eventually fail to load during the normal run of my application.

    Basically if I load/unload various Alembic models that have been prefabbed (to include custom material/timelines) throughout the course of my application running - they will eventually fail to load with the error: "failed to load alembic at Assets/My Scene/Models/example.abc".

    It's very strange because they will all load normally for 1-2 minutes of Play time, and then fail out of the blue.

    The worst part is that once the references are broken, they seem to be broken for the good in the editor. I have to close and reopen the editor for the errors to go away.
     
    Last edited: May 2, 2020
  35. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    I am sorry, I have not seen this error before.
    Please post a new message with more info on what you are doing and maybe we can get at the bottom of it.
     
  36. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    Hello. I still am not able to fix my memory leak problem tied to alembic. I noticed (By process of elimination) that the longer the animation plays, the memory id being consumed and it does not stop. I don't usually let it go past 3 Gig but I almost let go so far to crash my computer. Is there a solution to this issue?
    A lot of help would be appreciated as I want to give others a chance to try out the demo, however, it would be a bad idea due to this.
     
    Last edited: May 14, 2020
  37. dvillaverde-drakhar

    dvillaverde-drakhar

    Joined:
    Aug 29, 2018
    Posts:
    11
    Any update about Alembic working on Nintendo Switch?
     
  38. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    It doesn't work on Switch?
     
  39. shaunimsorry

    shaunimsorry

    Joined:
    Jan 19, 2019
    Posts:
    11
    Was trying to export a Alembic Page Turn From C4D(Using Mospline to turn the page) works fine in the editor but will not build. The Game seems to be missing the alembic animation and does not show the model even. Any ideas what i could be doing wrong between C4D > Unity
     
  40. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    255
    Here is an easy question. I know that the API is not yet public but all I want to do it GetComponent<AlembicStreamPlayer>() to see if an object has this component. But AlembicStreamPlayer is inaccessible since it is an internal private class. Soo is there any "clean" way for me to find out if the component is there? Can I query the Animator for to find out if it is an Alembic animation?
     
  41. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    The alembic plugin is unlikely to support platforms apart from the desktop ones.
    Porting it to other platforms would amount to getting the native code to compile on Switch (not trivial but not impossible either).
     
  42. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Alembic 2.0.X has all those classes available publicly. You can always use something like this:
    GetComponent(typeof(HingeJoint)) building a Type from a string.
     
  43. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    83
    Are you on Windows by any chance? If so, can you double-check in your build settings (File -> Build Settings) that the architecture is set to x86_64? The Alembic package only works in 64-bit builds (alembic objects won't appear at all in 32-bit builds which might be what you are experiencing).

    alembic_windowsBuildArchitecture.png

    If that doesn't resolve your issue, could you let us know the following to investigate further:
    1. Which Unity version are you using?
    2. Which Alembic package version are you using?
    3. Do you see the objects when re-importing the generated Alembic back in C4D?
    4. Do you see the Alembic objects in the Unity Scene/Game view before building you game (or when entering playmode)?
    Cheers!
     
  44. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    823
    Hello again,

    I have a problem with motion vectors / alembic interpolation for alembics exported with RealFlow.
    Here is a small repro showing the problem: https://github.com/JohannesDeml/AlembicInterpolationBug



    The two things that are strange here:
    * Motion Vectors don't work for the alembic even though the alembic standard material is applied
    * The mesh seems to not interpolate its frames even though interpolation is enabled

    Any idea what the root cause of this might be?
    When opening the exported mesh in blender it correctly goes through the animation frame by frame.

    Edit:
    Is it maybe due to the everchanging geometry of the mesh that changes vertex number in the animation? If that is the case, is there a possibility to somehow work around that limitation?
     
    Last edited: Aug 20, 2020
  45. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey,

    Please make a new thread so we can talk about it.
    The motion vectors currently have a problem where they are inverted. The fix is in, but unreleased yet. you can validate if it fixes your issue by setting motion scale to -1 (make sure you dirty the time for the AlembicStreamPlayer).

    I am unaware of the geometry interpolation issue. Will try to take a look at it when I have a chance.
     
  46. VodkaDude

    VodkaDude

    Joined:
    Sep 18, 2020
    Posts:
    3
    I'm trying to import hair with an Alembic file. I'm using Unity's built-in Alembic package.
    I can drag the file into the asset section but cant open the file
     

    Attached Files:

  47. dhdhp

    dhdhp

    Joined:
    Sep 23, 2020
    Posts:
    1
  48. Sapien_

    Sapien_

    Joined:
    Mar 5, 2018
    Posts:
    102
    I have a bullet that has an alembic mesh as a child. In the editor everything is fine, however, on build the alembic mesh is invisible. You can use create object on the alembic mesh its self and it will work in build, but not if it has a script attached or is a child of a scriptable object, it will once again be invisible in build.

    I am 100% sure that I didn't program anything to make it deactivate or turn its self invisible.
     
  49. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    Hey,

    Thanks for the message.
    Please make a new thread and tag it with [Alembic]
    Does your file contain curves by chance ? (noticed the hair name ) Asking cause they are not currently supported.
    If you send me the file (PM), I could take a look at it.
     
  50. yumeng1022

    yumeng1022

    Joined:
    Dec 4, 2019
    Posts:
    15
    Hi guys , because i have a project in plan , can you give us some estimated time when alembic or other format you mentioned will support for mobile ? 2021 or 2022 ? thanks.
     
Thread Status:
Not open for further replies.