f3d-app / f3d

Fast and minimalist 3D viewer.
https://f3d.app
BSD 3-Clause "New" or "Revised" License
2.92k stars 214 forks source link

f3d-web does not support loading OpenUSD files #1676

Open jo-chemla opened 1 month ago

jo-chemla commented 1 month ago

Describe the bug The f3d-web is useful to load mesh files (via file browser or providing url-param). However, it cannot load OpenUSD files like usd, usdz, usda, usdc. The same files can be opened correctly with the desktop version of f3d.

Files with such extensions won't be listed by the file explorer modal, and switching File-Explorer filter from All supported types to All files in order to select such a usd file will result in console error File /abc.usdz cannot be opened

To Reproduce Steps to reproduce the behavior:

  1. Download sample models from apple assets
  2. load them correctly in f3d desktop app
  3. Try to load them in f3d-web
  4. see error in console File /abc.usdz cannot be opened which come from here because scene.supports(filePath) returns false for files with usd extension (impl)

Expected behavior Should the DF3D_PLUGIN_BUILD_USD flag simply be set to ON in webassembly/build.sh? It is currently not specified, hence probably defaulting to OFF. Seems that the OpenUSD plugin and flag were added in 2.3.0. Extensions EXTENSIONS usd usdc usda usdz are correctly passed here

Also, the doc could explicit which flavors of OpenUSD extensions are supported here doc/user/SUPPORTED_FORMATS.md to add .usdz, .usda, .usdc

mwestphal commented 1 month ago

Hi @jo-chemla

Indeed, this is correct, afaik OpenUSD does not seems trivial to build for WebAssembly. Keep in mind F3DWeb is pretty experimental.

I'm adding this to the main WebAssembly issue: https://github.com/f3d-app/f3d/issues/1252

mwestphal commented 1 month ago

Also, the doc could explicit which flavors of OpenUSD extensions are supported here doc/user/SUPPORTED_FORMATS.md to add .usdz, .usda, .usdc

Indeed, this is missing (FYI @stepperpig )

Meakk commented 1 month ago

@jo-chemla your analysis is correct.
In case you (or someone else) want to give it a try, we need to build USD in the Docker image here, and then enable the plugin in webassembly/build.sh.
However, USD is using Boost and TBB, so these need to be installed in the Docker image too.

jo-chemla commented 1 month ago

Wow that was fast. Thank you both for getting back and adding this to this mega-thread. For some references,

mwestphal commented 4 weeks ago

Also, the doc could explicit which flavors of OpenUSD extensions are supported here doc/user/SUPPORTED_FORMATS.md to add .usdz, .usda, .usdc

Indeed, this is missing (FYI @stepperpig )

Thanks, I've added it in our documentation: https://f3d.app/doc/user/SUPPORTED_FORMATS.html