Unfortunately this seems too much for my small brain; I am not a programmer. All the same, you have helped me realize the complexity of what I was asking for.
My use case is rather alot to explain, but my simple brain thought “Hey, I dont need all the bit depth of an 8-bit greyscale texture. Maybe I can can store 30 low bit-depth textures inside one high-bit deth texture. Think of all the GPU memory and texture lookups I could save”
But ofcourse it is not that simple :L
Edit: After playing around with packing alpha masks, this is what I came up with. This shader encodes a binary black/white mask into a greyscale texture, and then decodes it.
It works fine and I can technically pack more than 1 mask. However I want to pack grey scale images, not binary black/white masks. Can someone confirm for me whether this is actually possible?