Editing a .gltf before rendering occurs

Hi all, I have a 3d asset i am rendering. I was looking at the .gltf file and I noticed it contains an array of images that are the textures for the asset.

Would it be possible for me to store say dozens of different textures… and then before rendering the .gltf file I would edit what textures I want that asset to render?

Are there reasons not to do this?

Can you store a variable to be set in a gltf or do i need to look into using something like fs.writeFile() ?

Appreciate some guidance and insight.

Thanks

You can do it with Inspector in PlayGround or Sandbox, for example.

1 Like

@Edgewoods the gltf variants extension is doing just this and more :slight_smile: if that helps

Hi @sebavan

is the extension you are referring to this one? KHR_materials_variants ?

Thanks @labris Iabris, Its helpful to look at… but unfortunately i need something that works at run time as I will be randomly picking what textures to apply to various assets right before they render.

I see no ptoblems here, the Inspector is just to show that it is easily possible.
You just need to write some piece of code to set it all together (texture choice, editing, then rendering).

1 Like

yup this one exactly

Hello @Edgewoods just checking in, was your question answered? :smiley: