Additive texture2D combining : alternative method to GetPixels() ?

Hello,

I’m actually composing my textures at loading time with the GetPixels() / SetPixels() method.
I have to combine more than 9 textures into 1, so placing them in a realtime shader can’t be done. I have to bake the final pic at loading time.
Unfortunately, on top of thinking that there exists a faster way, this GetPixels() method just forces me to put all my 612 image files to RGBA32 format. Which is ultra heavy … :confused:

I thought there could be some other way around … For example, would a Shader bi-texture combining loop allow me to bake the final result to a Texture2D object ?

Thank you for your attention ^^

edit : I tried to deploy a build with all 612 RGBA32 uncompressed files, was expecting a 1.4 Mb x 612 = 857 Mb app size … But Unity managed to compress it to a total of 56 Mo, even with such a format setting. Awesomely clever conversion job, guys.
So this is not really a problem anymore, but I would still be very interested in alternative techniques !

I guess something like that should be possible:
Set up a dedicated RenderToTexture-camera with disabled Clear Flags. Maybe even an additive skybox material could work to render each texture. Then change texture for each pass and use camera.Render…

using a shader for this is very well possible, the question is more how the logic would work without a blending map.

Your main restriction is the texture lookups which might require that you do the blending together in multiple passes

Oh sorry, I forgot to mention a very important thing : it’s targeted for iPhone/Android, so RenderTextures not allowed here :confused:

Yes, I thought about something like 2-passes AlphaBlending loops (so here, 4~5 for 9 textures), each loop baking a new Texture2D, etc …

Is this even possible to bake a shader into a Texture2D without RenderTexture ?

Yes, thats possible.
apply it to a guitexture for example and then use readpixels to get it from there into your bake texture

Awesone, thank you Dreamora, I’ll test that asap :slight_smile: