A continuous function for defining unique values to a 1024x1024 image with a 24 bit 3 color channel image I need to generate a color map which I am not sure exist. I have a 1024x1024 image which would contain 2^20 pixels. I have 3 color channels which each have 8 bits which would leave us with 2^24 possible colors. This means that there would actually be enough different pixel values for a unique value for a 4096x4096. This problem is easy to solve with non continuous colors where you simply use 4 bits of the final channel on both of the first two channels to create two 12 bit channels. 
Here is an example of the non-continuous version:

Each of the individual sub-squares has a different blue value which gives us a unique value. This may be hard to see with the eye, as they are only changing by a very small amount. Using this technique, it is easy to fill up an entire 4096x4096 with unique, mathematically predictable colors.
Unfortunately, I have a new constraint where all three channels of the map must remain continuos. What I mean by this is that each individual neighboring pixels channel value does not change by more than one in value. For instance, a pixel with a red value of 10 may have direct neighbors with a red value of either 9, 10 or 11 The reason for this constraint is that when sampling from this texture, individual neighboring pixels may be sub-sampled and linear interpolated together and when going along the edge of the sub-boxes, this would result in inaccurate values.
To put it in a slightly different way, I need a function f and f^-1
f(x, y) = r, g, b 
f^-1(r, g, b) = x, y   (only existing in the original x,y range)
with r, g, b, being 8 bit numbers (the integers 0 - 255) and x and y being 10 bit numbers (the integers 0 - 1023). All neighboring r,g,b values must be continuous. By continuous, I mean that each individual neighboring pixels channel value does not change by more than one in each channel. Do such functions exist, and if so, what are they?
 A: Unless I'm missing something in your conditions, it seems that a pair of 12-bit Gray Codes can be used to do what you desire on a $2^{12}\times 2^{12}$ board (which you could then take any $2^{10}\times 2^{10}$ sub-board of this board for your purposes).
Let $G_0...G_{4095}$ be a 12-bit Gray code. To each pixel $(x,y)$ in your $2^{12}\times 2^{12}$ board, split the concatenation $G_xG_y$ into 3 8-bit substrings; these will be the channel colors. Within a given row, the first 12 bits of the 24 channel bits are constant (so the red channel is constant across rows) and there is exactly one bit that changes between $(x,y)$ and $(x,y+1)$ in the second 12 bits (so only one of the three channels is changing, although as $y$ moves along that channel will sometimes be the blue channel (when the difference of $G_y$ and $G_{y+1}$ is in the final 8 bits) and sometimes in the green channel (when the difference of $G_y$ and $G_{y+1}$ is in the first 4 bits). Similarly, down columns the blue channel is constant and the red and green channels are changing depending on where the difference between $G_x$ and $G_{x+1}$ occurs. Furthermore it is trivial to invert this mapping given an RGB point; simply split the green channel between the left and right, then look up the position of each 12-bit half in the original Gray Code.
Incidentally you can make many such mappings from this Gray Code method by mixing where the bits from $G_x$ and $G_y$ go in the RGB coordinates while still maintaining the stronger condition that exactly one channel changes from one bit to a neighboring bit. For example, sending the bits of $G_x$ to the even position bits of the RGB bits and the bits of $G_y$ to the odd position bits is one way to allow all three channels to change within each row or column.
