I'm working on upgrading my understanding of computer graphics, and this issue has totally stumped me.
I'm 99.9% sure I've got Linear -> sRGB
happening correctly in my renderer. As shown by the difference in the gradients in the gradient image. Gradients which are "perceptually linear" come from interpolating white >>> black
in non-linear sRGB
space, which is done by the example on the left in all the images ("without srgb framebuffer" in opengl terms actually means there is no color space conversion which means it's all in sRGB
- kind of confusing)
I'm 95% sure that blends for anti-aliasing should be done in linear color space with pixel coverage being exactly equal to the blend factor. No other interpretation makes sense conceptually. There's no way blending should be in any other color space. And the theoretically correct value of a pixel to be a blend w_1*c_1 + w_2*c_2 + ... w_n*c_n
for a pixel with n
colors c_i
with the corresponding w_i
giving the proportion 0 <= w_i <= 1
of the pixel covered by that color (at least given simple box filtering antialiasing as the baseline assumption). And so those weights really should sum to 1 w_1 + w_2 + ... w_n = 1
so that, for instance, if you have several nearly white colors blended, your result will not become a lot darker. Which brings me to the conclusion "pixel coverage exactly equals the blend factor" (-- the only reason this is at 95% and not higher is that maybe the simple box filtering model is the problem here, but I'm pretty sure that should give very reasonable results which makes the next bit pretty confusing)
I'm about 85% sure that the circles in the image attached look better when I was doing the blending naively (i.e. in sRGB space) instead of doing the blending in linear space. This is more aesthetic though, so feedback on this part would be nice:
So the big question is: how is this resolved? All of the conclusions above seem pretty solid, and I haven't been able to find any holes in them, but they also can't all be true at the same time. Or can they? Is it that I have a wrong piece in this puzzle, or is it that the pieces actually fit together if I arrange them with each other a little differently?
Any help would be appreciated!