Load an obj file multiple times with different textures

For example, I have 5 different textures in a folder for a single obj fish model. Then I want to display 5 fishes on my website with these 5 textures. How to achieve that?

I have an array to store texture information: textures = [‘texture1.jpg’, ‘texture2.jpg’, ‘texture3.jpg’, ‘texture4.jpg’, ‘texture5.jpg’]

Thanks a lot!

Have a look at this example:


The code loads the OBJ once but clones the mesh five times and applies for each instance a different material. For your particular use case, you apply for each material a custom texture instead of generating a random color.