Sketchfab Forum

Change textures with API


(Slawomir Hylinski) #1

Hi,

can I change textures in my modeli via API? I want have one model but I need configure color by changing textures. It is possible? The best way is changing textures without reload web.


#2

Hi,

Yes, you can load a texture from a CORS-enabled URL and apply it to the model:

https://sketchfab.com/developers/viewer/functions#api-addTexture


(Slawomir Hylinski) #3

Thank you :smile:


(Realvu) #4

Is it possible to change textures which are already registered in sketchfab?
In other words, register multiple textures in 3D settings and change it via api.


#5

When the viewer is downloaded/initialized, it only references textures that are actually used in 3D settings. So, if you upload textures in the Texture Manager but do not actually use them, you will not be able to access them with the Viewer API. To change textures "on the fly" they need to be images hosted elsewhere with a CORS-enabled URL, or a base64-encoded image.