We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

wait for gltf to load before applying materials

Home Forums Puzzles wait for gltf to load before applying materials

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #45770
    swatchyb
    Customer

    Hi,
    My configurator uses all external assets (gltf’s and materials) and loads them as needed. However, on occasion (usually on mobile), the gltf’s aren’t loaded in time so that the object misses the application of the material, and just appears as the default (white) – which is obviously concerning to the user. Is there a way to predicate the application of a material on the state/presence of a target object (gltf) in the scene?
    I know that I can reduce this symptom with compression, but maybe this is a perfect use for the new “is scene loaded” puzzle.
    Can you advise best approach?
    Many thanks!

    #45771
    xeon
    Customer

    Is scene loaded does not appear to solve this problem. The puzzle will return true when the gltf is in memory but this can be long before the gltf is visible in the browser especially with respect to mobile devices.

    This is even more complicated if your combined files start to get near the 50MB limits of the browser and you need to force things out of memory during a load.

    Assuming you are not in that situation,
    You can use a full screen preloader or effect such as blur to hide the effects of the scene building in the background until your materials downloaded and gltf responds as loaded via the “when loaded do”

    Basically you are just putting a html screen in front of the app until everything is done.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #45781
    swatchyb
    Customer

    Hi Xeon,

    Sorry to miss your quick and kind answer.

    This is not so much about “display” – meaning hiding the scene until loaded. I was really looking to make the application of materials wait until the 1 to 10 gltfs (dynamic quantity depending on the product) have loaded, since if the gltf is not loaded, it misses the material, and remains as default (white). A good total load time is <2secs and poor around 5. Anyway, instead of a long winded explanation, as a temp fix, I just added an “after 0.5sec do” puzzle and put all of the material loads in that – seems to work most of the time without appreciable delay in full render.

    But thanks for making me think a bit ;)

    #45786
    xeon
    Customer

    Adding time for a process like waiting on a gltf or material to load often leads to varying results by users equipment, internet download speed, device type .. etc. I recommend throttling performance in chrome developer mode to make sure you give enough time.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

    #45807
    core3d
    Customer

    I think you need promise for that. You can wait promise for loading everyting after that you trigger to show your scene.
    Promise

    #45817
    xeon
    Customer

    That sounds good…going to give that a few tests.

    UPDATE: I tried this out. In my testing ( I look forward to someone else giving it a test). The promise returns true when the scene or requested item is loaded in memory…not when its visible and in scene within the browser window.

    So on small textures or gltfs…you cant really tell. Load in something very large with complex reflections, etc…and it fires way before the scene is loaded in my testing.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com
    Tutorials - https://www.xeons3dlab.com

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.