Sketchfab Forum

API update: materials and post processing filters

(Mauricesvay) #1

Hi guys,

we've updated the Viewer API documentation with new functions:

You can now add textures and change materials on the fly with the Materials API.
The Post processing API also let's you apply filters, like you what you can do in the editor. This endpoint is not totally stable and might change in the future.

(Klaasnienhuis) #2

Hey Maurice, this looks great! Together with the Objects methods (hide, show, etc...) this seems like the building blocks for product configurators.
In the SetMaterial example, there's a line

materialToUpdate.channels.DiffuseColor.enable = false;

which disables the diffuse color. Is there documentation which describes all available channels of the materials? And is there a difference between the regular and pbr materials when modifying them through the API?

Also, the configurator experiment here, is that compatible with the Objects modethods in the viewer API or is it a different system?

(Mauricesvay) #3

Hi @klaasnienhuis,

The list of available channels is not documented yet, but you can simply print out materialToUpdate.channels to see the list of available channels. Both Classic and PBR channels are contained in each material, but we only use the channels that correspond to the current renderer (Classic or PBR). Consequently, updating PBR channels should work just like for classic channels.

In the configurator experiment you are mentioning, I was using the Objects methods to hide/show objects. These method should still work. But the new method are probably more appropriate when all you want is change the material.

(Klaasnienhuis) #4

Thanks @mauricesvay.