Remove a texture


(Rowdysign) #1

Goodmorning,

How can I remove an already present texture in a Sketchfab scene? I would like to remove a texture from an object and then apply a color to it instead.

I could not find information about it in API documentation (https://sketchfab.com/developers/viewer/functions) so I tried to edit the material object myself. For instance I set the "Object.texCoordUnitList" and "Object.AlbedoPBR.texture" to false or null but both did not had any effect: the texture was still present in the scene.


Alternate textures for a model?
(Miekeroth) #2

Hi @rowdysign It is actually not that hard. If you know which material the texture belongs to, you can switch between texture and color in the 3d settings of the model it self. So go to the material tab in the 3d settings, select the material the texture is attached to and change the texture into a color clicking the image right before the bar that controls the influence of the texture or color.


(Miekeroth) #3


(Miekeroth) #4


(Rowdysign) #5

Hello Mieke, thank you for your reply, but my question is within the context of the Sketchfab API. I know how to switch between texture and color in the Sketchfab 3D settings interface but I do not know how to do that within the Sketchfab API. The API (Application Programming Interface) allows developers like me to change settings programmatically.


(Miekeroth) #6

OK. well. I am working on that too and the moment I have a working application I will make a tutorial for it. Right now maybe my tutorial for annotations might give you a clue on how to handle it because most of the declarations within the api are similar. The textures are like the nodes actually (of the top of my head). @james made an application for that one. He linked to it in one of my questions about that.
Here the tutorial about annotations:

How to make a real 3d model application

(Miekeroth) #7

Have been thinking of this one further because it is one of the posibilities I want to use too (it is great for my anatomy tutorials :wink: ). Will come back to it tomorrow ok?


(Rowdysign) #8

Great, thank you. I'm looking forward to it. Interesting tutorial you have.


(Shaderbytes) #9

Setting it to null does work , are you remembering to call setMaterial function after making the change? Check out this page I made to test the api a while back , view the source to see the javascript , One button injects textures into the model that were never there before , the other button removes them again ( and some color changing for other materials ) but it is straight forward stuff.

http://www.shaderbytes.co.za/clients/hardheadveterans/sketchfab_api_dev/index.html


(Rowdysign) #10

Not calling the setMaterial function was indeed the reason why my texture did not disappear. I did not know I had to use setMaterial function to a texture also (I only thought I needed to use setMaterial function in order to set a color).

But now I know, thank you very much! :grinning:


(Shaderbytes) #11

All good , you always have to call it for any change you make , also now you have seen some code on how to construct the texture object of a texture being injected into the api at runtime :wink:


(Vr Go) #12

what i met problem is the texture cannot change but albedo and opacity the normal map can not change,
how can i switch the normal map on/off outside sketchfab editor


(Shaderbytes) #13

you can remove any texture by setting the texture property of the channel to null. You can also change the factor of the channel to zero without removing the texture.

EDIT… dont forget to update the material to the backend as well… making the changes only locally will have no affect on the model