Combine Terrain Splat Texture and Alpha into Single PNG

I'm messing around with terrain texture splatting such as  I was wondering would it be able to combine the splatted texture with the alpha mask into a single PNG to save on disk memory?  I know the splatted texture is scaled unlike the alpha texture, but maybe two different com.jme.image.Texture's could be created in code/memory from the single physical file?  Is this possible?  Has anybody done this before?

I think it's not worth it, splitting the texture in parts means processing it entirely including the mip map levels. In a shader it's possible to do that, but you still have to sample the same texture twice.

What you can do though, is to put 4 alphamaps into one RGBA texture, but that only works in a shader.

why do you have to sample twice, a fragment shader is more than capable of reading r g b and a values and blending based upon alpha one texture is read in and it writes to a separate texture one layer at a time, a definite space saver and possible idea for implementing holes in height-maps (I love the holes in height-maps idea XD) also to overcome a limit on the function you can string build the function at runtime for as many layers as you need! Amazing stuff

Sorry daniel but I think you don't actually know how a shader works :stuck_out_tongue:

You have to sample twice because the detail map and alpha map are mapped at different frequencies. The detail map is more finegrained on the terrain while alpha map isn't. If the frequencies were the same then you don't need to use splatting or shader at all, since you can just pre-bake the splat texture offline.

Making holes in heightmaps is possible by altering the mesh or by using alpha blending.

Edited because of my own relative stupidity!

Momoko, I do actually know how a shader works do  :stuck_out_tongue: do you have any examples of your holes in heightmaps theory?