three.js icon indicating copy to clipboard operation
three.js copied to clipboard

USDZ assets containing USDC files throw warning

Open antpb opened this issue 2 years ago • 5 comments

Describe the bug I have a threejs based WordPress Plugin (https://3ov.xyz) and was working to add the latest usdz supports (It's working really well! Thanks for this update!) The assets provided in the PR were working really well for me so far.

I'm seeing issues with Apple's sample assets from their site so there may be some edge cases not passing parse. THREE.USDZLoader: No usda file found.

To Reproduce

Use the retro television asset from https://developer.apple.com/augmented-reality/quick-look/

Load asset into a scene and you should see a console warning and a blank scene THREE.USDZLoader: No usda file found.

In my code I am just using a simple useLoader

const usdz = useLoader( USDZLoader, url);

I'm still digging but not sure how best to debug as I'm pretty unfamiliar with the usdz file type.

Platform:

  • Device: [Desktop, Mobile]
  • OS: [MacOS]
  • Browser: [Chrome, Firefox, Safari, Edge]
  • Initial USDZ Three.js version: [144.0]

antpb avatar Sep 01 '22 03:09 antpb

The USDZLoader doesn't support usdz files that use usdc files internally, only usda.

We'd need someone from Pixar/Apple to explain how to read these files or someone will have to figure it out.

mrdoob avatar Sep 01 '22 22:09 mrdoob

Thanks, I'll do some digging! Bit ambitious, but maybe I can help as part of my work to support it. The extensions have been very confusing to map in my head. 😆

antpb avatar Sep 01 '22 22:09 antpb

Leaving a link here for anyone else that may dig in the future. I found this threejs implementation of usdz: https://www.usdz-viewer.net/ and was able to load the usdc file inside a usdz

And the source of that loader for the viewer is here: https://github.com/ponahoum/three-usdz-loader

antpb avatar Sep 01 '22 23:09 antpb

https://www.usdz-viewer.net/ uses autodesks opensourced USD fork which loads the USD binaries via WASM. Info here.

This will unlikely be easily merged into ThreeJS core, nor soon.

I have my own personal opinions about completely reinventing the USD stack, and it is indeed much more than just a file format. However the best bet for short term usdc decompiling in threejs is probably to look at https://github.com/syoyo/tinyusdz which has reverse engineered the binary format.

Vochsel avatar Sep 02 '22 23:09 Vochsel

This will unlikely be easily merged into ThreeJS core, nor soon.

I think that we do not merge file-format loaders into core at all, even GLTFLoader.

LeviPesin avatar Sep 03 '22 08:09 LeviPesin

Fwiw would love support for this :~)

darnfish avatar Feb 05 '23 00:02 darnfish

Leaving a link here for anyone else that may dig in the future. I found this threejs implementation of usdz: https://www.usdz-viewer.net/ and was able to load the usdc file inside a usdz

And the source of that loader for the viewer is here: https://github.com/ponahoum/three-usdz-loader

Did you get it to work? I have tried implementing it using Reactjs but I am continuously getting an error. Any idea why I am getting loading USDZ model TypeError: THREE.TextureLoader is not a constructor? I have moved external dependencies (.wasm / worker files) in a subfolder of the public folder.

Musadiqkhan-nullbrainer avatar Jul 29 '23 09:07 Musadiqkhan-nullbrainer

Leaving a link here for anyone else that may dig in the future. I found this threejs implementation of usdz: https://www.usdz-viewer.net/ and was able to load the usdc file inside a usdz And the source of that loader for the viewer is here: https://github.com/ponahoum/three-usdz-loader

Did you get it to work? I have tried implementing it using Reactjs but I am continuously getting an error. Any idea why I am getting loading USDZ model TypeError: THREE.TextureLoader is not a constructor? I have moved external dependencies (.wasm / worker files) in a subfolder of the public folder.

Haven't ran into this before, could you share some screenshots? If you don't necessarily need USDZ / USDC files, you can use usdztogltf.com (disclaimer: I built this for this exact issue) to convert files to .gltf or .glb which Three.js plays with nicer.

darnfish avatar Jul 30 '23 17:07 darnfish

Leaving a link here for anyone else that may dig in the future. I found this threejs implementation of usdz: https://www.usdz-viewer.net/ and was able to load the usdc file inside a usdz And the source of that loader for the viewer is here: https://github.com/ponahoum/three-usdz-loader

Did you get it to work? I have tried implementing it using Reactjs but I am continuously getting an error. Any idea why I am getting loading USDZ model TypeError: THREE.TextureLoader is not a constructor? I have moved external dependencies (.wasm / worker files) in a subfolder of the public folder.

Haven't ran into this before, could you share some screenshots? If you don't necessarily need USDZ / USDC files, you can use usdztogltf.com (disclaimer: I built this for this exact issue) to convert files to .gltf or .glb which Three.js plays with nicer.

That's the whole issue. I specifically need USDC and USDZ files. Here's the link: https://laidar-new-app.vercel.app/. You can check console for error.

Musadiqkhan-nullbrainer avatar Jul 30 '23 17:07 Musadiqkhan-nullbrainer

usdztogltf.com

Hi could you please provide this as a js library or something. That would be really helpful!

oootkarsh avatar May 16 '24 09:05 oootkarsh