No Proper Preload functionality via API


(Shaderbytes) #1

kinda sucks that you dont have a proper preload functionality in the api
currently it just pauses the model display at the texture loading part
the viewer still shows the rendered thumb first , then shows the blured version of the thumb
since my model has many items i hide when it first loads i do not want this thumb display or the blurred display happening … i just want the preloader
sure you can just hide the iframe , but now you have no preloader altogether


(Paul Sketch) #2

Initialization option doesn’t work for that ?
( https://help.sketchfab.com/hc/en-us/articles/202509036-Interface-and-Options#url-query )

client.init( urlid, {
    success: function onSuccess( api ){ },
    error: function onError() { },
    preload: 1,
    autostart: 1
} );

(Shaderbytes) #3

it only pauses the model at the texture load start, so you dont get the texture loading bar or the model displaying while the textures are loading.

You still get the thumb loading first , then when the model is loading you get the preloader over a blurred version of the thumb.


(Paul Sketch) #4

it’s not displayed, only the blurred version is

We cannot show nothing ?
Hiding the iframe would be the solution in the case of nothingness being the goal.

it doesn’t show the model until everything is loaded.
What do you expect of a “preload” then ?


(Shaderbytes) #5

only a preloader :wink:


(Paul Sketch) #6

preload=1&autostart =1 means

  • no thumb,
  • load over a blurred thumb
  • show model only when we have all data

for example open this link in a new browser tab “https://sketchfab.com/models/79ee998c9b544fd09ce5a1da010b5b50/embed?preload=1&autostart=1

What “preloader” means for you ?


(Shaderbytes) #7

anyway i does still show the thumb … im just busy with a prototype page currrently , i will send you the link later in a pm. So this is a fight suite you can assign many patches all over the suite, this is handled by each patch being a separate piece of geometry , the are colors black because they are the means to select a patch you want to add/edit…

so when the site loads i hide all the patches , when you want to add a patch i toggle the display of all those objects. The have click events so when you click one then it can hide the other unused ones again and display a 2d image creation tool for that patch.

So the patches are all visible in the thumb , when i do not want , all in the blurred version , since it is the thumb blurred. setting preload to 1 just then pause the model at the point the model is finished loading , with the current model preloader stuck at 100% and the blurred background until the image are loaded


(Shaderbytes) #8

ok i will try autostart as well.

The thing here is you have two different loads happening

  1. the model
  2. the textures

You have a preloader ( a progress indicator ) for the model
You also have a different preloader ( a progress indicator ) for textures

Currently setting preload to 1 simply pauses the first preloader at 100% and does not display the second preloader


(Shaderbytes) #9

the ideal solution would be to have both the model and the textures preloading, and also not show the blurred thumb, you dont have to show it , it would be perfect if it was an option perhaps so by default it shows but you can then opt out of this logic.

Anyway you could use the model preloader, for both the model and textures.


(Paul Sketch) #10

preload + autostart to prevent the non blurred thumb to show up.

if not hiding the iframe, you could “save view” where there is nothing to show (or a wait thing), then at model display, you set a camera position ?

Ok Options you’d like are then;

  • thumb (show/hide thumb)
  • thumblurred (show/hide thumb blurred)

you’d end up with api.init options something like
{preload:1,autostart:1,thumb:0,thumbBlurred:0}


(Shaderbytes) #11

Thanks AutoStart removed the upfront thumb load :wink:

yeah those options look good.

The only other thing is that when setting preload to 1 the preloader only preloads the model, it gets to 100% then pauses for the rest of the time the textures are loading. It would be nice if it calculated the loading of both the model and the textures, not a train smash but something to think about, so you still hide the model showing textures poping in but the loader is actively showing load progress of the textures ( like the bar on top does when preload = 0 )


(Stephomi) #12

I think only the low res textures are taken into account for the progress bar splitting, I’ll take a look.

So it can be improved, but it definitely won’t be perfect as :

  • when everything is downloaded, many things occured : spatial hierarchy building, uploading geometries, buffers and textures to gpu, shader compilation (!!), etc. These things are typically sync/blocking so we can’t do anything about it at the moment
  • we don’t receive progress advancement for texture downloading, so like the top bar loading bar we are using a fake advancement loading