ERP said:
Don't you get odd results with linear interpolation of disparate colors in that space? Notably lerping through a third color?
I'd assume you use 16 bits L and 8 for U and V, but that doesn't work at all with addative or multiplicative blending. Although I could imagine authoring content that could work.
If one uses a Luv-like color space there's no hope to have correct blending in the general case even with pre-authored content, due to the fact that CIE chromacity is a (non trivial) function of luminance, so the answer to your question is that additive and multiplicative blending modes don't work out of the box.
In my 'quest' for a good FP16 replacement that could also be used with hw 'fixed function' blending (c'mon NVIDIA and ATI..give me non cacheable textures fetches in a fragment shader
) I evaluated different color spaces and I found only one tricky color format (RGBE) that can support hw multiplicative blending as it is, but additive blending is another beast.
I also tried to make some use of imaginary exponentials, hyperbolic trigonometric functions and quaternions to represent colors..a complete failure, lol
It's worth to notice that all color spaces that one can derive from RGB using a linear transform preserve only additive and lerp blending modes, not multiplicative..but unfurtunately all the interesting linear transform one can use map also to negative color components, and we can't store a negative value as it is into a INT8 buffer.
We can do that applying an affine transform but then all, but one (lerp!), preserved blending modes are not preseved anymore.
That's why a tweaked fixed range YUV color representation could support hw lerp blending out of the box.
In the end the solution to the problem of blending is to reuse the frame buffer as texture and to blend in a pixel shader if you want a correct solution.
Lerp blending on CIE Luv can't obviously work but in the end if you try to lerp between CIE Luv colors you get pleasant results most of the time.
Since bilinear filtering is a 2 passes lerp blend, tweaking the color representation to make it work well (problems arise with carry propagation between the most and least significant bits of luminance) gives you very good results! (and I store the luminance logarithm cause I must support a very high range, so linear blending between logarithms doesn't give us a linear interpolation of luminance, on a small range with a fixed point lumimance representation it should be possible to obtain even better results)
At this time I only used this funky color buffers to represent render targets and I use those as textures while resolving a multisampled or supersampled buffer with a simple bilinear filtering gently provided by TMUs
I haven't tried it yet but probably this format would do a good job even representing HDR textures, that's why I'm storing the most significant bits of luminance in the alpha channel cause it would compress nicely with DXT5 (8 bit per pixel HDR textures that doesn't require extra filtering in a shader would be very nice indeed
)
At some point in the future I would like to do some more work on the 24 bits version cause I think it can be improved to the level to make it useable.
ciao,
Marco