Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

USD for Unity Updates

Discussion in 'External Tools Previews' started by marief_unity, Mar 18, 2019.

  1. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    22
    I believe this GitHub issue should fix both of your problems. There is a separate issue with AR QuickLook (on the Apple side), which we cannot fix, which is what you may be hitting. Regardless, the issue I filed is the correct blanket issue and we'll see what we can do to work around the AR QuickLook issue at the same time.
     
    marief_unity likes this.
  2. LittleBlueDot

    LittleBlueDot

    Joined:
    May 15, 2019
    Posts:
    15
    That worked thanks.
     
    jeremyco likes this.
  3. LittleBlueDot

    LittleBlueDot

    Joined:
    May 15, 2019
    Posts:
    15
    ina likes this.
  4. LittleBlueDot

    LittleBlueDot

    Joined:
    May 15, 2019
    Posts:
    15
    @jeremyco
    It doesn't seem to be available for iOS ? This is the error I get when I try to build for iOS device.

    Assets/Samples/USD/1.0.0-preview.4/HelloUsd/HelloUsdExample.cs(16,7): error CS0246: The type or namespace name 'USD' could not be found (are you missing a using directive or an assembly reference?)
     
    Last edited: May 22, 2019
    maherdaaloul likes this.
  5. Udit_N

    Udit_N

    Joined:
    Mar 9, 2015
    Posts:
    17
    Hey @marief_unity Thank you so much...That worked really well...
     
  6. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    The USDZ exporter has the same issue as Khronos' GLB exporter: it doesn't really fit into Unity's philosophy of "image assets" being indepent of source files and just doesn't export textures if they are PSD files, or TGA, or runtime Render Textures... That is a huge blocker for people just wanting to export something. It would be cool if there would at least be export options for that - e.g. "bake what you can and just gimme a model that looks close to what I see in Unity".
     
  7. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    And a bug report: scaling objects before export doesn't influence the exported size.
     
  8. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    120
    Hi @fherbst,

    Would you mind reporting both issues in https://github.com/Unity-Technologies/usd-unity-sdk/issues ?

    Please provide as much info as possible (Unity version, OS version, other package used, repro steps).

    Thanks for the feedback !
     
  9. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    22
    RenderTextures will not export, but all associated texture files should -- for example, Volund from The Blacksmith exports with the original TIFF and PSD files. That said, these file types are not supported in USDZ archives (per the specification), so in that case, we really should convert them to png on export (this is not done currently).

    If you're seeing that texture files are not exporting, can you file an issue on github with a repro case?
    https://github.com/Unity-Technologies/usd-unity-sdk/issues
     
  10. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    424
    Hm... Maybe I'm doing something wrong when following the workaround instructions. Have you tried exporting the animated model that I've shared to USDZ and then run it on iOS? Does the animation work?
     
  11. XRA

    XRA

    Joined:
    Aug 26, 2010
    Posts:
    197
    *edit* Actually it may not be too bad of a problem, was able to bypass the check for isReadable but not sure if it will limit anything.

    is there any plan to fix the "Mesh not readable:" warning when exporting USD, or any current method to work around that issue?

    This is kind of a severe but not-so apparent limitation, especially for large teams & projects.

    We would like to have art pipeline benefits using formats like USD, but cannot sacrifice memory on-device with having the meshes marked as read-write

    (Meshes marked read write are double the memory cost).

    Also toggling the mesh import setting temporarily when exporting will also waste time with additional asset re-imports once toggling the setting back to off, so that isn't ideal either. (hundreds of meshes might be part of a selection for export)
     
    Last edited: Jun 26, 2019
  12. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    424
    Any info on this (the question cited above)? :) I can't seem to get the animation working on iOS, whatever hierarchy I try. I tried importing other animated USDZs that actually work and noticed that they have two important prims: Skeleton and SkelRoot (parent of Skeleton and Mesh prims). Whereas my USDZ didn't have SkelRoot. So, I added an additional parent to the whole animated game object in Unity and now I have SkelRoot. But it still doesn't animate on iOS :/ What's interesting is that bones of the rigs in the other USDZs have usd prims attached to all of them, whereas the one exported from Unity doesn't have that. Not sure if that could be a problem and no idea how to fix/change that on my side. So, those are my recent findings – maybe they'll help you in any way to make it work on iOS (or if it already does on your end, it would be great to get the instructions how to make it work, as the ones on github aren't enough :/ ).
     
  13. createtheimaginable

    createtheimaginable

    Joined:
    Jan 30, 2019
    Posts:
    29
    What Digital Content Creation (DCC) tool are you using to create your animation?

    Some people have had success making the animation in Maya/Maya LT and then converting the FBX to USD...

    Also, Houdini Indie supports USD exports if you compile the SideFX USD plugin for it...
     
  14. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    424
    The animation is being made in Maya. Have you seen people successfully converting FBX to USDZ through Unity? If not, do you have any links I could look into?
     
  15. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    22
    @DominoOne Good news -- the rig export issue has been resolved in our dev branch, the next step is to validate that models animate on iOS. I will validate this for the immanent 1.0.1 release, however if there are major blocking issues, it may still not make it into this release, I will do my best to get it in though (just setting expectations).

    @XRA Regarding unreadable meshes -- without a readable mesh, there is no CPU data to export. I don't think there is any way to avoid this.
     
    Blarp likes this.
  16. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
  17. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    22
    @fherbst I saw that issue -- it's actually not a hard fix, but it comes with a major performance hit, so we will need to make a special case for IL2CPP.

    But we don't have a USD build setup for Android or iOS yet, is that your intended use case for IL2CPP?
     
  18. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    At some point yes, but first it would be for a Desktop project that's on IL2CPP for various reasons.
    With some tinkering I even got the "competition" (Khronos Group's GLTF package) working in WebGL with IL2CPP.
    (Note that I'm mostly interested in the USD/USDZ export options)

    Just out of curiosity - why does it have a major performance hit?
     
  19. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    424
    Thank you for the update! Hoping for the best :)
     
  20. maherdaaloul

    maherdaaloul

    Joined:
    Jul 19, 2019
    Posts:
    2
    @jeremyco Hi, I'm currently developing an app for IOS that load from a back-office a non rigged and non animated 3d objects(fbx file format) and display them in augmented reality mode, now my client wants to make the app capable of loading usdz file at run-time, is unity dev team working on developing an API(compatible IOS) that will make it possible for us to load usdz files at run time? if there is a work development on this API, can we know the status? thanks in advance
     
    Last edited: Jul 19, 2019
    Blarp likes this.
  21. marief_unity

    marief_unity

    Unity Technologies

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

    USD 1.0.1-preview.1 has been released !

    To get started, open the package manager (Window > Package Manager), enable preview packages (in "Advanced" options), search for USD and click the install or update button.

    Here's the changelog:

    New features
    - Linux support

    Bug fixes
    - NullReferenceException on USD export (#67)
    - Path of .usd file does not match textures in the archive (#88)
    - Build error when sample is imported
    - Timeline: Playback sometimes spews errors (#93)
    - Skeleton bindings below the root are not discovered (#92)
    - Normals update after opening standard shader (#91)
    - UsdSkel export fails when rig root is the model root (#89)
    - VariantSets on the root UsdAsset results in errors (#77)
    - Bones do not match bindpose (#98)
    - Standard shader "pops" when opening the inspector (#102)

    Known issues
    - USDz export is not working when IL2CPP is used as Scripting Back-end
    - USDz export with animation does not work
    - A timesample is created every frame for every prims at export
    - "Export Transform Overrides" a USDskel asset with a rotation overrides results in a distorted asset
    - "Export Transform Overrides" provides a new transform even for unchanged prims
    - When importing as Prefabs, editions are lost at play
    - Texture2D parameters are not preserved on round trip
    - Mesh import orientation="leftHanded" is not handled correctly
    - No iOS or Android support
    - Importing USDZ does not import textures

    Your feedback is more than welcome :)
    Next steps are more bug fixes and improving the workflow.

    Thanks !
     
    Last edited: Jul 30, 2019
    Blarp and jeremyco like this.
  22. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    207
    and ios ;)
     
    maherdaaloul likes this.
  23. maherdaaloul

    maherdaaloul

    Joined:
    Jul 19, 2019
    Posts:
    2
    Any news on the IOS support? please
     
    Blarp likes this.
  24. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    @marief_unity Would be great if you could, like main Unity releases, have a "Known Issues" section.
    Top of that list, for me at least: "Export is not working when IL2CPP is used as Scripting Backend. Needs to use Mono for now."
     
    Blarp and marief_unity like this.
  25. marief_unity

    marief_unity

    Unity Technologies

    Joined:
    Oct 9, 2018
    Posts:
    120
    it's done, thanks for suggesting it.
     
    Blarp and fherbst like this.
  26. StudioV

    StudioV

    Joined:
    Aug 29, 2017
    Posts:
    3
    Is it possible to just use usd to import the animation and then apply that to a skinned mesh (the same model just imported as a fbx) in unity?
     
  27. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    I was just looking into why runtime texture export fails and found that basically there is none implemented! ShaderExporterBase has an #ifdef UNITY_EDITOR around the relevant parts and then just throws an exception if someone tries that at runtime with a totally wrong comment on it "too many things can go wrong (can't encode compressed textures, etc)".

    Note that this is incorrect, as numerous exporters (FBX, GLTF etc) show and I implemented myself in the past - you can always blit a compressed texture into an uncompressed one, and get that out as proper file. Even texture arrays can be unpacked.

    Also, there's a bug - the code there only works for textures on disk, not textures that only live in memory. It fails with exceptions when trying to export textures that aren't actual files on disk (e.g. texture assets that are subassets, textures created in memory, ...).

    And third, do you allow pull requests on the USDZ repo?
     
    Last edited: Aug 6, 2019
  28. UDN_79b9e8f3-d750-4b36-834d-11152461f1f9

    UDN_79b9e8f3-d750-4b36-834d-11152461f1f9

    Joined:
    Aug 6, 2019
    Posts:
    2
    After importing usd, the shader connected to the material doesn't seem to be loaded.
    Our material hiearachy is Material / UsdPreviewSurface / UsdUVTexture / UsdPrimvarReader_float2.

    And do you have any plans to support Curve?
     
  29. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    22
    Yes, but this feature currently only works with Timeline. You can import a rigged USD model (either via UsdSkel or vertex animation cache) and then import "clips" of different animations from different USD files onto the timeline.
     
  30. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    22
    That all sounds correct, the current workflow is highly asset-centric, though it doesn't need to be.

    Would you mind opening a feature request on GitHub to add support for this?
     
  31. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    22
    You must set the material import mode to "Preview Surface" after the initial import and then refresh. Have you already tried this?

    I would open a feature request on GitHub for curve support, explaining your use case and how you would like them to work in Unity (e.g. do you need tessellation support or is it sufficient to have piece-wise linear approximations? Do you need to evaluate the curves in C# or do you just want to see them render? etc).
     
  32. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
  33. UDN_79b9e8f3-d750-4b36-834d-11152461f1f9

    UDN_79b9e8f3-d750-4b36-834d-11152461f1f9

    Joined:
    Aug 6, 2019
    Posts:
    2
    @jeremyco i alread tried import mode to "preview surface" and reimport and refresh. but don't access shader scheme.

    and i want to see curve in unity. we use basisCurves. so i hope, basisCurve in usdfile see in unity.
     
  34. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    375
    Hi,

    Is there a reason why I can't import a usdz file? If this package can export a usdz file, it should be able to import it right?

    Bye,

    Jean
     
  35. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    375
    Hi,

    quick feedback: if you try to refresh a usd prefab form the asset editor window directly, you get errors:

    Destroying assets is not permitted to avoid data loss.
    If you really want to remove an asset use DestroyImmediate (theObject, true);
    UnityEngine.Object:DestroyImmediate(Object)
    Unity.Formats.USD.SceneImporter:RemoveComponent(GameObject) (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Runtime/Scripts/IO/Scene/SceneImporter.cs:293)
    Unity.Formats.USD.<BuildScene>d__9:MoveNext() (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Runtime/Scripts/IO/Scene/SceneImporter.cs:331)
    Unity.Formats.USD.SceneImporter:BuildScene(Scene, GameObject, SceneImportOptions, PrimMap, Boolean) (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Runtime/Scripts/IO/Scene/SceneImporter.cs:282)
    Unity.Formats.USD.SceneImporter:ImportUsd(GameObject, Scene, PrimMap, Boolean, SceneImportOptions) (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Runtime/Scripts/IO/Scene/SceneImporter.cs:259)
    Unity.Formats.USD.SceneImporter:ImportUsd(GameObject, Scene, PrimMap, SceneImportOptions) (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Runtime/Scripts/IO/Scene/SceneImporter.cs:243)
    Unity.Formats.USD.UsdAsset:Reload(Boolean) (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Runtime/Scripts/Behaviors/UsdAsset.cs:548)
    Unity.Formats.USD.UsdAssetEditor:ReloadFromUsd(UsdAsset, Boolean) (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Editor/Scripts/Behaviors/UsdAssetEditor.cs:268)
    Unity.Formats.USD.UsdAssetEditor:OnInspectorGUI() (at Library/PackageCache/com.unity.formats.usd@1.0.1-preview.1/Editor/Scripts/Behaviors/UsdAssetEditor.cs:114)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    it seems you must open the prefab for it to work. If that's the case, maybe the inspector should take that into account to avoid these errors?

    Bye,

    Jean
     
  36. Jens_Giraffentoast

    Jens_Giraffentoast

    Joined:
    Sep 3, 2019
    Posts:
    1
    Any workaround for that?
     
  37. ShamGP

    ShamGP

    Joined:
    Aug 9, 2017
    Posts:
    2
    Hi... I couldn't export animated USDZ from unity using this...
     
  38. ShamGP

    ShamGP

    Joined:
    Aug 9, 2017
    Posts:
    2
    Any tutor link for this?
     
  39. x2stone

    x2stone

    Joined:
    Dec 17, 2014
    Posts:
    11
    The ability to load USD files at runtime from an external source (disk, or URL) on iOS is for me (and I guess for many people) the most expected functionnality !
     
    maherdaaloul likes this.
  40. dschmuck

    dschmuck

    Joined:
    Nov 27, 2017
    Posts:
    8
    Hey guys.
    We have been playing around with USD in Unity and we are thinking about building our pipeline around it.
    One thing I haven't found any information on is how to get playback with alembic files in USD assets
    working for animation.
    We have had no problems getting animated .usd files to playback in Unity, but loading in .abc files into the USD asset will not result in playback of the alembic's animation (when using the same workflow as with .usd files).
    Is there another workflow for alembics using the USD Assets.
    From the information here:
    https://blogs.unity3d.com/2019/03/28/pixars-universal-scene-description-for-unity-out-in-preview/
    and here:
    https://github.com/Unity-Technologies/usd-unity-sdk
    it sounded like it should work to load in alembic files inside the usd asset and then have them playback using timeline.
    We do not want to use the "regular" unity alembic workflow, because we want to keep the alembics on the server and just reference them in using the usd asset component...

    Hope somebody can give us some info on how to get this to work!
    Thank you guys!!
     
  41. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    35
    Hey @dschmuck ! When you mention that "loading in .abc files into the USD asset" does not work, do you mean:
    1 - That your alembic file is referenced inside your USD file?
    or
    2 - You are importing the alembic file directly in your scene (using the menus "USD -> import as *" and selecting a .abc)?

    I got both methods working in our tests using these steps:
    - Import your USD or Alembic file as Game Objects through the USD menu
    - Create a new Timeline
    - Drag your imported gameobject in your Timeline (the left section) and choose "Add USD Playable Track". Then drag your asset again into the newly created track to add the clip (right section of the Timeline).

    If using referenced alembics, the USD file referencing them needs to have "endTimeCode" and "startTimeCode" set in the metadata to correspond with the alembic range. The alembic won't play properly if it's missing those metadata.

    Let us know if these steps work out for you!
     
    dschmuck likes this.
  42. dschmuck

    dschmuck

    Joined:
    Nov 27, 2017
    Posts:
    8
    Thank you very much for your answer!
    I was using the second workflow: importing the alembic into the scene, but using prefab instead of as Gameobject.
    I tried it again today with a very simple alembic (just a cube with a simple transform animation). This worked as expected. Apparently the problem was with the alembic I used for testing.
    Are there any limitations for using alembics with the unity USD workflow? When using the alembic package and the alembic stream player in unity it plays back fine.

    Another thing I noticed in my tests is that the animation of the alembic always comes in with 300 frames length regardless of the actual length of the alembics animation (my test cube has 105 frames of animation exported to .abc but loading it into timeline will create a 300 frame long track)

    Thanks already for the help :)
     
  43. cguertin

    cguertin

    Unity Technologies

    Joined:
    Aug 20, 2019
    Posts:
    35
    Ohh, that's interesting. We haven't currently encountered any specific limitations but I would be curious to try and replicate the issue on our end. If possible, would you be able to send me one of the alembics that was causing issue? Or the steps that were used to create that alembic (which software it was created from, were there any special export settings, etc...)

    Yeah, this is unfortunately a known limitation of the Timeline at the moment. Any new Timeline clip will always default to a specific set length instead of adjusting automatically to the content. The manual workaround for now is to right-click on your clip and select "Match Content" to automatically resize. We're hoping to improve this in the future but there is no ETA at the moment.
     
    dschmuck likes this.
  44. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    424
    I can't see that anyone to have already mentioned it, so... Exported USDZs don't display textures on iOS 13 QuickLook (still looks good on iOS 12 though). Also, what should be noted is that the alpha channel (i. e. opacity map of a material) is assigned separately on iOS 13 – it doesn't automatically use the A channel of the diffuse texture anymore (the A channel of the diffuse can be assigned explicitly though).
     
  45. mikerz1985

    mikerz1985

    Joined:
    Oct 23, 2014
    Posts:
    69
    Is there any rough ETA for mobile support for the USD package? I am most interested in loading a usd file with custom data on it at runtime. This will allow me the ability to create, load and use cross platform, semantic assets.

    I'm interested in iOS and also android (particularly the oculus quest).
     
    maherdaaloul likes this.
  46. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,641
    Hi @jeremyco & @cguertin , given that Video textures and the Video player aren't supported. I quickly spun up a texture animation using timeline to animate through the textures on a 3D plane with audio, which plays well.

    However, when using the USDz export, the animation isn't exported. Tried also adding the USD Recorder Track and set it up, but with little success.

    Any ideas if it's possible to export a plane with an animated texture using timeline to USDz?
     
  47. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    @SimonDarksideJ Maybe you have more luck with many Planes (one for each frame) and animating visibility instead of texture if you really need to get a video playing?
     
  48. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,641
    That is an interesting proposition @fherbst , one I hadn't considered. I'll give it a try.
     
  49. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    608
    @jeremyco I can't get USD to work in a project I tried today. I tried on both 2019.1 and 2019.2

    Always getting:
    ApplicationException: USD ERROR: Failed verification: ' fileFormat '
    UnityEngine.Debug:LogException(Exception)
    USD.NET.Unity.DiagnosticHandler:OnError(String)
    pxr.DiagnosticHandler:SwigDirectorOnError(String)
    pxr.UsdCsPINVOKE:UsdStage_CreateNew__SWIG_1(String)
    pxr.UsdStage:CreateNew(String)
    USD.NET.Scene:Create(String)
     
  50. ellka

    ellka

    Unity Technologies

    Joined:
    Jun 17, 2019
    Posts:
    11
    Hi all,

    USD 1.0.2-preview.1 has been released !
    Here is the change log of this release:

    Added
    • Option to handle basis conversion "as FBX"
    • Support for "Sphere" schema
    Changed
    • Fix the "Decompose" function to handle matrices with very small determinant
    • Allow exporting transparency from Standard shader
    • Fix the "ImportMesh" sample to works in edit mode
    • Handle skinned primitive that inherits skeleton data (joint indices and weight) from parent prim but don't define those themselves
    We're currently actively working on the future of the Usd package, that may explain a slow down in feature/bug fix releases. But it's for the best ;)!
     
unityunity