Search Unity

USD for Unity Updates

Discussion in 'Editor Workflows' started by marief_unity, Mar 18, 2019.

  1. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    20
    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:
    4
    That worked thanks.
     
    jeremyco likes this.
  3. LittleBlueDot

    LittleBlueDot

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

    LittleBlueDot

    Joined:
    May 15, 2019
    Posts:
    4
    @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:
    264
    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:
    264
    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:
    113
    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:
    20
    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:
    419
    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:
    187
    *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:
    419
    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:
    8
    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:
    419
    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:
    20
    @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:
    264
  17. jeremyco

    jeremyco

    Unity Technologies

    Joined:
    Oct 17, 2018
    Posts:
    20
    @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:
    264
    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:
    419
    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:
    113
    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:
    184
    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:
    264
    @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:
    113
    it's done, thanks for suggesting it.
     
    Blarp and fherbst like this.
  26. StudioV

    StudioV

    Joined:
    Aug 29, 2017
    Posts:
    1
    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:
    264
    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:
    20
    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:
    20
    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:
    20
    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:
    264
  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:
    335
    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:
    335
    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?