Recommend one or more TextureLoader(s)?

Hi Forum.

I’m writing a Webapp that uses threejs, and I’m really happy that threejs exists. :slight_smile:

Anyway, in my scene, I have a lot of cubes (THREE.BoxGeometry) having a THREE.Mesh each.

The texture for each cube is an image fetched through a url using a THREE.TextureLoader.

Each cube can also change it’s image each X seconds.

Also one cube can have the same image as another (it would be nice to enable caching).

Now my question is: Would you recommend having just one THREE.TextureLoader instance and have each cube use its load function? Or would you recommend having a THREE.TextureLoader instance for each cube?

I could imagine having a THREE.TextureLoader for each cube would take up a lot more memory, but each image could be loaded faster, maybe?

You just need a single instance of THREE.TextureLoader for your entire app. You have no performance gain if you use more than one loader object.

1 Like