I did some experimenting with this method, both packing 3 values and using binary encoding.
In principle it worked fine when only dealing with it as a float value, but when you write it to a texture I had two conclusions.
-
texture filtering will mangle your values so you need to essentially do nearest neighbor sampling to keep it from garbling your encoding so this will result in a pixelated look.
-
compression will also scramble your values so no luck there.
Some other observations.
Digital encoding as binary was more resistant to noise and I was able to partially reconstruction the binary encoded data to some degree in cases where the decimal shifting alone got completely scrambled due to floating point shifting.
So In short I don’t think this method is practical with textures due to texture filtering and compression. If you were able to disable texture filtering on one channel maybe you could interpolate it through the vertex shader to smooth it out. But I doubt you could do that with just one channel.
One hack maybe to encode a binary switch by comparing the values in two different channels?