question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Updating texture using scene graph does not apply for usdz models in AR

See original GitHub issue

Description

I’m trying to update a texture on runtime based on this example: https://modelviewer.dev/examples/scenegraph/#swapTextures

This works perfectly in the browser and in AR mode for GLB models, however, the texture is not reflected for USDZ models in QuickLook.

Expected texture applied on the model: image

Resulting texture shown in iOS Quick Look: image

Is this something that’s out of model-viewer’s control? I understand that scene graph is only supported for GLTF files, but I’m not sure if it is supposed to work the same for USDZ models.

Version

  • model-viewer: v1.6.0

Browser Affected

  • Chrome, version: xx.x.xxxx.xx
  • Edge
  • Firefox
  • IE
  • Safari

OS

  • Android
  • iOS
  • Linux
  • MacOS
  • Windows

AR

  • WebXR
  • SceneViewer
  • QuickLook

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
pzyucommented, Mar 30, 2021

Sure, I see. Thanks for the reply. Since model-viewer is built on three.js, I’m thinking of using the USDZ exporter that they have as shown in the example here: https://threejs.org/examples/?q=usdz#misc_exporter_usdz

Would it be possible to export the model as a GLTF and then export it as USDZ using three.js?

So I did manage to get it to work using three.js’ USDZ exporter by doing the following:

  1. Export the model as GLTF
  2. Load it into another three.js scene as an array buffer
  3. Export the scene using the USDZ exporter as a blob
  4. Setting the href property of a link as the blob

Working result!

Currently the texture is flipped, but shouldn’t be much of a problem to resolve.

image

0reactions
elalishcommented, Apr 1, 2021

Awesome, thank you! And I bet three.js would be happy to have your fix for .png textures too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

usdz texture issue (using usdz_converter) - Apple Developer
Hi all, I'm having a hard time to create .usdz file with texture using usdz_converter. The converter itself works ok and generates .usdz...
Read more >
AR Quick Look and USDZ - Netguru
USDZ bundles all models and textures into a single file for efficient delivery ... In AR Quick Look, we can use such functionalities...
Read more >
<model-viewer> Materials & Scene Examples
Create textures​​ As above, you can change these values in AR, but only in WebXR mode. iOS Quick Look reflects these texture changes...
Read more >
Material texture change not working anymore #3783 - GitHub
The material change which i did through scene graph is not working anymor. When changing color the spa cabinet color should be changed...
Read more >
Best Practices for Sharing and Embedding USDz and GLB Files
In KeyShot Pro, go to File, Export, and select Export to GLB/GLTF. If you would like to provide an option to view the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found