PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.04k stars 1.2k forks source link

[usdAbc] UsdAbcAlembicFileFormat does not use ArAsset API for reading assets #2961

Open nvidia-jomiller opened 7 months ago

nvidia-jomiller commented 7 months ago

Description of Issue

We are unable to load any Alembic SdfAssetPaths that resolve to a non file-based path such as a URL / URI. The internal implementation of UsdAbcAlembicFileFormat::Read always assumes that the provided resolvedPath argument is a normal file path that can be fed directly to Alembic's IArchive. If resolvedPath is a URL Alembic will fail with an Unsupported format: 'Unknown' error since the UsdAbcAlembicFileFormat has not converted, or mapped, resolvedPath to something that Alembic's IArchive can load. Ideally, UsdAbcAlembicFileFormat should use ArGetResolver().OpenAsset() with the ArAsset API to make sure that the underlying ArAssetResolver plugin is invoked when trying to load Alembic assets.

Steps to Reproduce

  1. Download repro.zip
  2. Extract repro.zip to /some/path/repro
  3. Navigate to /some/path/repro
  4. Run usdview Scene.usdz
  5. The following warning / error should appear:
    Warning: in _ReportErrors at line 3170 of /home/jomiller/projects/usd-builds/dev/USD/pxr/usd/usd/stage.cpp -- In </World/Scene>: Could not open asset @/home/jomiller/repros/Scene.usdz[Assets/testAbcCamera.abc]@ for reference introduced by @Scene.usdz@</World/Scene> -- Failed to open Alembic archive "/home/jomiller/repros/Scene.usdz[Assets/testAbcCamera.abc]": Unsupported format: 'Unknown'. (instantiating stage on stage @Scene.usdz@ <0x3244120>)

System Information (OS, Hardware)

Windows 11 Enterprise Processor AMD Ryzen Threadripper PRO 3975WX 32-Cores 3.50 GHz Installed RAM 128 GB (128 GB usable)

jesschimein commented 7 months ago

Filed as internal issue #USD-9340

spiffmon commented 7 months ago

Hi @nvidia-jomiller - we'd be keen on a PR for this one, especially if it comes with a test case (I reckon an abc inside a usdz should exercize the non-FILE aspect of OpenAsset and IArchive sufficiently?

nvidia-jomiller commented 7 months ago

Hey @spiffmon, thanks for taking a look!

That's a great point and I think a usdz would work in this scenario. I'll test out the usdz approach so it can be added as a repro case here and used as a test case for a PR later on.

nvidia-jomiller commented 7 months ago

Updated the description of the issue with steps to reproduce the error with a USDZ. Thanks for the suggestion @spiffmon!

I'm not sure when I'll have bandwidth to submit a PR but this issue seems like it might be a good candidate for someone to get their feet wet with Ar APIs and SdfFileFormat plugins

roggiezhang-nv commented 2 weeks ago

@spiffmon Hi, Spiff. I created a PR to fix the Abc file plugin issue. I left the detailed descriptions in the PR about different solutions we currently tried and their cons and pros. While it still works only for Windows, it's submitted so we can have discussions first to see which direction we should go forward.

@nvmkuruc @nvidia-jomiller for vis.