I am displaying quake3 levels using lightmaps. I am using deferred shading, so I end up needing to render the rgb componets of the lightmap into the g-buffer. I am using a high precision G buffer (16 or 32 bit), and since the lightmap is 8 bytes per component, it is a waste to use 3 slots of the g-buffer for the lightmap. At most I should need 24 bytes, which is 2.5 of the 16 bit or .75 or the 32 bit.
So the question:
What is a good method to encode several floats into 1? It’s sort of the space filling curve question…
Its pretty clear how to do this for integers by using shifts, etc… but I need it to work in shaders…
Any thoughts or references? Thanks!