mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.81k stars 35.38k forks source link

USDZ assets containing USDC files throw warning #24574

Open antpb opened 2 years ago

antpb commented 2 years ago

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:

mrdoob commented 2 years ago

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.

antpb commented 2 years ago

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 commented 2 years ago

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

Vochsel commented 2 years ago

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.

LeviPesin commented 2 years ago

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.

darnfish commented 1 year ago

Fwiw would love support for this :~)

Musadiqkhan-nullbrainer commented 1 year ago

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.

darnfish commented 1 year ago

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.

Musadiqkhan-nullbrainer commented 1 year ago

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.

oootkarsh commented 6 months ago

usdztogltf.com

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