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 8 posts - 1 through 8 (of 8 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.

    #78383
    tomtm
    Participant

    Hi
    unfortunately due to a NDA I can‘t share the scene.
    Maybe I have to many calls when I start an animation, but this wouldn‘t explain, why it‘s working after I called it
    one time.

    Thanks for the script and help!
    Tom

    #78384
    kdv
    Participant

    I can‘t share the scene.

    then you’re on your own :unsure:

    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.

    #78385
    c4cc
    Participant

    I can‘t share the scene.

    Might I suggest distorting/messing up the mesh, changing the colors of materials/shaders/procedural effects, etc, to change its physical appearance WHILE RETAINING the original line/vertices count and shader/procedural effect methods the same? That way, the principles of the answer can be derived while anonymity retained.

    #78448
    tomtm
    Participant

    I hope I can post a sample scene soon.
    I am really curious how to make initialisation better, especially if you enter VR, there are likely more difficulties due to the nature of weaker hardware.

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