adobe / USD-Fileformat-plugins

A collection of USD fileformat plugins
298 stars 22 forks source link

glTF to USDZ conversion not supported? #7

Closed lanxinger closed 5 months ago

lanxinger commented 5 months ago

Expected Behaviour

I was trying to do a roundtrip to go from an input.usdz to .glb and then back to usdz

Actual Behaviour

Cannot save layer @test.usdz@: writing package usdz layer is not allowed through this API. Coding Error: in _WriteToFile at line 4744 of C:\repos\OpenUSD\pxr\usd\sdf\layer.cpp -- Cannot save layer @test.usdz@: writing package usdz layer is not allowed through this API.

Reproduce Scenario (including but not limited to)

Convert a given USDZ model to GLB and then try to convert that GLB to USDZ

Steps to Reproduce

see above

kwblackstone commented 5 months ago

The USDZ format is not really directly supported as a save format within USD as there are many complicated cases when moving to usdz. Instead, USDZ files are typically created using the usdzip tool. In the case of gltf, you wouldn't want to embed the gltf file into the usdz. You would probably want to flatten it to usd first, then you would also need to update the image paths which would no longer be correct.

I do think you bring up a good point though, that many users would like/expect to be able to do this. I think it makes sense to add some python samples in the future, as a howto, and will prioritize this for future development.

lanxinger commented 5 months ago

thanks @kwblackstone for confirming this. We are actually using Apple's usdzconvert python scripts currently to do these conversions and yes I was under the impression this code base would convert any to any (since it does take usdz input).

On that note the apple scripts worked fine with older versions of USD but even after updating the deprecated CreatePrimvar APIs to work with newer versions of USD they still fail their Arkitchecker. The scripts haven't been updated in years so I think there is definitely a need for this to be revisited and maybe provide some python samples for users that use updated code and checkers that do not fail.