-
Hi, I need to get each default texture from the materials of the model viewer, I managed to get them once I set the texture with material.['texture'].texture.source.setURI() method, before setting the uri it gives me undefined. How can I get this uri from the default texture of the modelViewer? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 16 replies
-
Textures loaded from a .glb have no URI because they are loaded from a buffer inside the .glb so there is no way to address them directly. You can check the type of the texture ( What are you aiming to do? I might be able to provide some other suggestions with a little more detail. |
Beta Was this translation helpful? Give feedback.
-
After doing that, I came up a doubt. How can I revert the texture to the default one properly? After changing the texture if I try to set the texture with |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Is it possible to revert a material using the originalGltfJson? I'm trying to make it to where if I swap to a specific material type, it will automatically swap another part back to it's original material because the newly "checked" material cannot be created/sold with that combination. Here is what I'm trying to achieve, I've got it to swap the material on DrawerBody if a lacquer color is chosen, but when I choose a Grasscloth material, it still swaps it to that material instead of back to the default "wood" material.
|
Beta Was this translation helpful? Give feedback.
Textures loaded from a .glb have no URI because they are loaded from a buffer inside the .glb so there is no way to address them directly. You can check the type of the texture (
modelviewer.model.materials[0].normalTexture.source.type
for instance) if it's 'embedded' there will be no URI, and if it's 'external' there should be a defined URI.What are you aiming to do? I might be able to provide some other suggestions with a little more detail.