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.

Initialisation/Preloading all Assets, incl. hidden

Home Forums General Questions Initialisation/Preloading all Assets, incl. hidden

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #78351
    tomtm
    Participant

    Hi,
    what is the best way to pre load all assets? I know, there are some other posts,
    but no of this code snippets did push everything in the memory before the app starts.

    Usually I place everything in the camera view and make things all unhidden and hide again.
    But this might be a little “old” school?
    Is there a code which would force all shaders to be compiled and objects
    be loaded in the memory before the app starts?

    Greets Tom

    #78355
    kdv
    Participant

    which would force all shaders to be compiled

    all material shaders are already compiled on loading.

    and objects be loaded in the memory

    app.scene.traverse(function(obj) {
      if (obj.isMesh) {
        if (obj.material.isMeshNodeMaterial) {
          for (let name in obj.material.nodeTextures) {
            app.renderer.initTexture(obj.material.nodeTextures[name]);
          }
        }
        app.renderer.updateGeometry(obj);
      }
    });

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #78381
    tomtm
    Participant

    Hi Kdv
    Do you put this script in the very beginning of the puzzle?
    I still have the situation, that some actions have some frame drops the first time they run.
    After playing the animation the second time, it is fine.

    #78382
    kdv
    Participant

    without your files it’s hard to find out what is the best way to get rid of lags :unsure: sometimes that code works fine, sometimes it’s not good enough.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

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