how can i pack (8bit color) x 2 into 16bit single channel?

how can i pack (8bit color) x 2 into 16bit single channel in shader? For example roughness + metallic value.

Not sure if this helps for now

Still new to Shaders…

M. Valentine has pointed a nice link to begin with.
This kind of problem is a basic one in computer algorithms when playing with bits and encoding values.

1 Like