Toggle texture property

I have developed this model: Huermeces_del_Cerro.html

It has two toggle buttons.
The left one, hides/shows certain object of the model.
The right one, switches the texture of main object from normal to highlighted.

I would like to change this action so that the right button switches the texture from colored to grayscale.
I have seen, in the Sketchfab “3D SETTINGS”, that this is possible by changing the texture “Format” from “RGB” to “Luminance”.

Is it possible to implement this feature with the API?
Could anyone suggest the basic lines of code required to assign either “RGB” or “Luminance” to the texture “Format” parameter?

Thank you,

Riccardo

Hi Riccardo,

Here you go: https://jsfiddle.net/PadreZippo/b4og295z/

James

It has worked. Thank you very much.

Is there a place where I can find the description of the data structure?
To know for instance what parameters and optional values are available under “material.channel”?

It’s not fully documented anywhere (material options are subject to change). I typically just print a material to the console and inspect it manually + compare to editor settings.

Ok. I have understood the approach.
Thank you for the hint.

Riccardo

1 Like