Superimpose one sprite on another

for example, I have a sprite of a character, and a sprites of different armor for him, how I can superimpose a sprite of armor on a sprite of a character and then use it on a game object?

I understand that you can use multiple sprites for an game object, but I think it will greatly affect performance cuz I need to use different sprites for legs, hands, head etc, and the “enemy characters” sprites should also be generated in this way, there can be many characters on the screen, 100+ or even 1000+

so I thought it would be nice to generate one sprite instead of using 5+ sprites on one game object

as far as I understand it, using several sprites should not be a problem

1 Like

Rendering sprites aren’t expensive by itself. You can render thousands of sprites without issue, assuming you don’t have lots and lots of overdraw. Your performance is more likely to be determined by how much Lua code is executed, e.g. having many on_input, on_message, and update being called every frame.

But with that said, you can accomplish what you want by rendering each sprite to a texture, and then display that texture.

Here’s a proof of concept project Potota did and posted on Discord. set the texture_sampler of /overlay#model to some image in the editor and it’ll work.
render_to_texture.zip (30.8 KB)

1 Like

This is especially true if all sprites use images from the same atlas (and some other rules):