API - change background / color of viewer

(Cscartdept) #1

How could I set the code to allow the user to pick a color for the background of the viewer or ad an image?


Hmm. You can change the image or color permanently with the Data API: https://docs.sketchfab.com/data-api/v3/index.html#!/models/patch_v3_models_uid_options

However, there'e currently no way to do this "on the fly" with the Viewer API. You could make the background transparent on Sketchfab and edit your own page behind the viewer, but I don't recommend it because we can't do antialiasing on models with a transparent background.

(Andrewleonard) #3

I have tried to use the DATA API with some success
I can set the background colour and lighting
What I do not understand is how to set a background image
Can you help me?
Please bear in mind that I have very little idea of what I am doing
I tried using: https://api.sketchfab.com/v3/me/backgrounds/51af6a870cce449eb75b0345feebaebb
but I get the response: "Options key background is not json"
This is the model I am using: https://sketchfab.com/models/7a36d1012033491da7044d1e06ef4149