I want modders to be able to add new images to my texture. Since each modder is working with their own .png, I'd like to combine a bunch of .png files into one texture for my mesh.

I was thinking I could do something like load each .png into an Image and then save the image as a byte array, then concatenate the byte arrays and load them into one giant image with Image.create_from_data().

But I was wondering if there is a better way. Heres the way I'm loading my texture now

I'm setting the texture albedo to a .png.

However, is it possible I can use a .tres file to load multiple images as one texture? I'm just not really sure what .tres files are...

I suppose another option would be to pass each .png to the shader as an array of textures and then somehow update the UV coordinates for each .png in the array? Not really sure how to do that either...

I'm just not really sure what .tres files are...

A tres file is a text file representation of the resource. Sometimes the asset itself is stored in text, but most tres files link to the binary data (link to the texture files, .png, .jpg, etc)


For combining the textures, what you could potentially do is use multiple sprite/texture-rect nodes for each texture, render it into a viewport, and then get the viewport texture and use it. You could convert the viewport to a normal texture (don’t remember how right off) if you want to delete the viewport and texture nodes. You could also save the viewport to a file as well if you wanted :)

@TwistedTwigleg Thanks! I'll give that method a try

Check blit rect. You can use it to draw a texture directly into another texture, then save as png.

8 months later