[Bf-committers] Color Unpremultiply

Brecht Van Lommel brechtvanlommel at pandora.be
Mon Feb 20 14:33:11 CET 2012


Hi,

On Mon, Feb 20, 2012 at 2:55 AM, Matt Ebb <matt at mke3.net> wrote:
> On Fri, Feb 17, 2012 at 8:04 PM, gespertino at gmail.com
> <gespertino at gmail.com> wrote:
>> First of all, the text in the tooltip is a little bit misleading. The
>> operation performed isn't done to avoid a fringe on light backgrounds. It's
>> done because colorspace conversions shouldn't be performed on premultiplied
>> data.
>> The resulting effect when doing it wrong is indeed a fringe, but what the
>> operation does is to deliver a properly converted image, not avoiding a
>> fringe.
>> This may sound silly, but I think that using a more accurate tooltip would
>> have an educational effect because people would know what it does or would
>> investigate more rather than "this is for reducing a fringe".
>> A fringe can come from a wrong compositing earlier, and believing that
>> color unpremultiply will fix it is wrong.
>
> +1, correct

Maybe the wording needs to be better and I'm happy to change it if you
come up with a better tooltip, but I disagree that enabling the option
delivers a "properly converted image". It doesn't, it just looks less
bad in some situations, it's only a heuristic. From my testing it
seems that sometimes enabling this option looks better, sometimes it
looks worse.

>> There is one exception, and that is when you will composite over a
>> black background. Then the associated alpha over formula becomes:
>> (R,G,B) + (1-A)*(0, 0, 0) = (R, G, B)
>>
> Please correct me if I missed something and I didn't get you point, but I
> think this is wrong.
> In an associated image, RGB in linear space has a correlation with alpha,
> which is also in linear space.

Maybe I should have used a better notation, but the conclusion is the
same, the components are the same in both.
(R*A,G*A,B*A) + (1-A)*(0, 0, 0) = (R*A, G*A, B*A)

When looking at the image on a black background it will look correct.
If you look at the image in Blender's image editor without enabling
alpha display it shows a black background, so not using Color
Unpremultiply will actually show the correct image there!

But I just noticed that in some releases ago the image editor alpha
display was changed to assume unassociated alpha, did not notice this
change in svn, will check on the patch that makes this an option ...

Brecht.


More information about the Bf-committers mailing list