Loading Multiple Image seqences causes browser to reload

Good Day,

We have created an experience with several images being used as textures that are applied on a
‘Paper’ mesh to simulate like a pencil writing or drawing on paper.

The issue is, Because of using several images and swapping the textures, The Browser is getting auto refreshed due to some reason.

Removing the Methods that loads and changes the texture solves this issue.

Can anyone please point me in the right direction to Solve the issue and/or Propose an alternative.

Thank you,

It would seem you are hitting a memory limit, make sure to dispose of textures and geometries no longer in use three.js docs

Load the textures ahead of time if possible. Load each texture to a different material and then Switch the materials instead of updating the same texture. If you must load an image on the fly then you have to 1st load the image to the GPU, then apply it to the texture, and this can cause a flicker or lag in itself. If you choose this route you simply need to update the textures envMap, and update the texture with “material.needsUpdate = true”. However, I highly suggest using multiple materials, even if they are the same except for the texture.

Hope this helps. I did this myself and even after successfully swapping images to the texture envMap, a 512x256 texture took enough time to be processed that it caused a latency and flicker on the swap.

Switching to multiple materials with the textures already applied was fast and seamless and provided the experience and affect I wanted.

I think in my current implementation, Timing the Dispose operation might be difficult as there are about 20 set of Images with around 150 images being swapped.

@D13, Your idea of loading to GPU might work, But the Fix I made after posting this question is to reduce down the no. of images that is being applied on to the texture using modulo operation…Basically Now I am jumping every 30 images in each set and reducing the memory load.

This also will cause some amount of lag or delay which I think will happen anyways even if I use a GPU load I guess.

1 Like