How do I modify model textures dynamically?

I am using appendAsync to load a gltf model from an S3 bucket.

I have managed to load the model successfully but I want to be able to replace the textures (png) after the model get’s loaded from a different folder within the S3.

Pretty much what I am trying to do is load the model with a base set of textures (png). But I need to replace this with different ones.

I am pretty new to Babylon and I don’t have much time to learn all the workings of the engine.

Could please someone advise the best course of action?

To further explain:

On the S3 I have a .gltf, .bin and a bunch of pngs that are added as textures.

I’ve managed to use the sandbox to simply drag and drop the new textures (they have the same name and shape, just the texture design changes) and they update correctly on the model.

How do I do this using scripts?

Thanks for all the help!

Hi @Juan_Jose_Rueda and welcome to the Babylon Forum! It looks like this thread should be able to help you.

1 Like