Saving texture data as fille?

Hi there!

I have a portfolio page, where I use multiple images (around 60) as textures for cube materials.
The first time the site loads it might take 20-30s to process, and on the second time it will go much faster, therefore i figured there is some cashing involved (?).

I thought to speed up the textures load by saving the texture as a file and then load it directly for the server (node), instead of letting the client process it. But as i was trying to save the texture to a JSON file i noticed some data is missing (Matrix3, img, etc).

Do you think this solution can work? Is there another solution to save textures on server side?
i cam using MeshPhongMaterial on desktop, and MeshLambertMaterial on mobile.


Thank! :slight_smile:

  1. Take a look at Persistent Asset Storage - How to save models & textures to users machine - you can save these files on user’s computer and make downloading and loading even faster (thanks to local SQLite and IndexedDB.)

  2. There’s probably no point in saving Texture’s JSON to a file. The same applies to the Material - shader compilation can take a moment, but unlikely to take as much as 30seconds.
    The main part of the Texture, the image, is kept in img - which is just an Image object holding bitmap data. If you have super-high quality images that take ages to process, you can consider loading low-quality versions first, and fetching HD images on-demand.