This patch adds the option to store environment textures in the LogLUV32 encoding,
which uses only a third of the memory that full float textures require.
Of course, it loses a bit of precision, but the difference should be below the visible
threshold in nearly every case. The supported luminance range is approximately 1e-19 to 1e19,
which is ~128EV and should be enough for any HDRI.
The encoding works by transforming the RGB colors into the YUV color space, where luminance
and color are separated. The base-2 logarithm of the luminance is stored as a 16bit fixed-point
value, and the U and V coordinates are stored in two 8bit fixed-point integers.
The main remaining problem is interpolation: Since the encoded colors are stored as uchar4s
in the regular texture slots, they are interpolated as uchars. Because of the encoding, this
works better than it might seem at first: U and V are separate fields in the uchar4, which
means that the color coordinates are decently interpolated. The interpolation of the luminance
works as well by combining the two interpolated 8bit fields. However, since the field actually
stores the logarithm of the luminance, the interpolation is performed in log-space as well,
leading to darker results.
Another current limitations is that the code assumes sRGB input data (that's hardcoded into
the conversion matrices). That has to be fixed at some point, but that's a general issue
with Cycles (see T46860).