[Bf-compositor] use alpha premultiplication in linear Color Space?

Francesco Paglia f.paglia.80 at gmail.com
Sat Apr 5 14:03:02 CEST 2014


Hi Lukas,
You're perfectly right, there are no issue with the combine rgba node.
Since I still  think there's something that sounds me strange I went on
trying to understand what's wrong with me or the node tree! :)

Finally I got what got me in error!
This button:

https://lh6.googleusercontent.com/-8d9zmPWcEdo/Uz_wFciddLI/AAAAAAAAI30/-1I878DqlLU/w259-h72-no/color%252Balpha.png


As you can see from the next image you're looking to a Visually associated
alpha image even if it is not really.

https://lh4.googleusercontent.com/-E3QP6SAS9TE/Uz_wFwk9HyI/AAAAAAAAI30/CeDw2snn6Jk/w1016-h812-no/visually.png


Here comes all my erroneous thought because as soon as I looked at that
image I was driven to think it was correctly premultiplied but it was not!

Then once plugged it in the alpha over the image again looked visually
correct.

https://lh5.googleusercontent.com/-0XvpRceiXx8/Uz_wF7EvhxI/AAAAAAAAI30/6LmwOsQlOhE/w957-h807-no/over.png


As soon as I started editing the alpha value the errors in the tree become
evident... But since the image looked premultiplied and visually correct I
was driven to hundreds of incorrect thought about how the nodes work.

So here comes my "final" thought:
Should unassociated images be properly showed in that display mode?


Thanks

Francesco


2014-04-04 17:53 GMT+02:00 Lukas Tönne <lukas.toenne at gmail.com>:

> The RGBA separate and combine nodes are fine IMO, they work just as
> expected. What could be useful would be to extend the "Set Alpha" node with
> an optional setting to handle premultiplication.
>
> As discussed on IRC what happens is that, when replacing the alpha
> component (either by "combine rgb" or "set alpha"), the rgb color
> components are still premultiplied with the old alpha value, thus giving an
> incorrect resulting associated color value.
>
> input color: (r,g,b,a) = (R*a, B*a, G*a, a), where (R,G,B) is the
> "original" unassociated color value
> replacing alpha: (r,g,b,a') = (R*a, B*a, G*a, a') i.e. the resulting color
> uses a wrong alpha factor for premul
> desired result: (r',g',b',a') = (R*a', G*a', B*a', a')
>
> Here's an example file that contains a node group which correctly replaces
> rgb along with alpha to the desired premultiplied color:
> http://www.pasteall.org/blend/28164
>
> This node group would be the alternative "Set Alpha" implementation when
> the proposed "premul" option is enabled.
>
>
> On Fri, Apr 4, 2014 at 4:45 PM, Francesco Paglia <f.paglia.80 at gmail.com>wrote:
>
>> After a discussion on blendercoders I understood why I had to add the
>> premult node at the beginning and at the end of my nodetree.
>>
>> The fact is that combine and separate rgba do not take into account any
>> property of the input.
>> The separate don't know if an input have associated or unassociated alpha
>> and the combine strictly act as a "container of independent channels" that
>> have to be further recombined.
>> This drive to the need of unassociate the alpha at the beginning of the
>> tree and to reassociate it at the end of the modification of the alpha
>> channel to make it properly working.
>>
>> I got confused because after combining the channels previously separated
>> I have not get any of the result I could expect but an image equal to the
>> original...
>> Here what I could expect:
>>
>> 1° the correct image with a lower alpha intensity
>> 2° an image with a lower alpha and black artifact
>> 3° a fully opaque rgb image (equal to the orginal but with black color
>> where the alpha should be) with an unassociated alpha
>>
>> Since non of those result came up to me I started thinking in a wrong way
>> that lead me to write the original post.
>> After a bit of discussion most of the question have been solved but after
>> further thinking and with the discussion in mind I'm even more convinced
>> that with my setup I should have get the third result.
>>
>> I think there's still some issue in the combine rgba node.
>>
>>
>>
>> 2014-04-04 14:37 GMT+02:00 Francesco Paglia <f.paglia.80 at gmail.com>:
>>
>> Hi Ton,
>>> let me say I used the term Fade because I was used to it coming from
>>> other Compositing packages.
>>> I mean the value of a pixel of a channel multiplied by another value
>>> should output the result of the multiplication .
>>> Alpha over comes later... after this operation!
>>>
>>> I think an image would explain much more than 100 words especially if my
>>> jargon isn't really appropriate :)
>>>
>>>
>>> https://lh4.googleusercontent.com/-f-dm0O5h_qs/Uz6nQz4s9qI/AAAAAAAAI14/CsFT1RmOzmw/w1358-h309-no/noprem.png
>>>
>>>
>>>
>>>
>>> 2014-04-04 13:45 GMT+02:00 Ton Roosendaal <ton at blender.org>:
>>>
>>> Hi,
>>>>
>>>> "Fade" can mean too many things.
>>>> You mean: "Image should become transparent - during an alpha-over
>>>> operation"?
>>>>
>>>> Well to start with - such effects look much different in linear, than
>>>> in non-linear spaces.
>>>>
>>>> And realize: premultiplied RGBA = alpha should not be changed. Not!
>>>> Straight alpha - yes, that you can do with what you like.
>>>>
>>>> -Ton-
>>>>
>>>> --------------------------------------------------------
>>>> Ton Roosendaal  -  ton at blender.org   -   www.blender.org
>>>> Chairman Blender Foundation - Producer Blender Institute
>>>> Entrepotdok 57A  -  1018AD Amsterdam  -  The Netherlands
>>>>
>>>>
>>>>
>>>> On 4 Apr, 2014, at 13:25, Francesco Paglia wrote:
>>>>
>>>> > Hi, hope I used a right title for this topic.
>>>> > I've just setup a simple nodegroup to make a fade node.
>>>> > Here the tree:
>>>> >
>>>> >
>>>> https://lh4.googleusercontent.com/-Mos7IL6bx4E/Uz6VHnKqZ3I/AAAAAAAAI1U/zJJ7zOFnRWQ/w1176-h368-no/fade_nodesetup.png
>>>> >
>>>> > As input of this group I've a renderlayer, if I'm not wrong the
>>>> compositor works with a linear workflow so why I have to add make alpha
>>>> straight at the beginning and a premultiply at the end to make it working
>>>> properly?
>>>> >
>>>> > Thanks for your help
>>>> > Francesco
>>>> >
>>>> > --
>>>> > Francesco Paglia
>>>> > Vfx and Production Supervisor
>>>> >
>>>> > mobile  +39 347.82.12.473
>>>> > e-mail   f.paglia.80 at gmail.com
>>>> >
>>>> > _______________________________________________
>>>> > Bf-compositor mailing list
>>>> > Bf-compositor at blender.org
>>>> > http://lists.blender.org/mailman/listinfo/bf-compositor
>>>>
>>>> _______________________________________________
>>>> Bf-compositor mailing list
>>>> Bf-compositor at blender.org
>>>> http://lists.blender.org/mailman/listinfo/bf-compositor
>>>>
>>>
>>>
>>>
>>> --
>>> Francesco Paglia
>>> Vfx and Production Supervisor
>>>
>>> mobile  +39 347.82.12.473
>>> e-mail   f.paglia.80 at gmail.com
>>>
>>>
>>
>>
>> --
>> Francesco Paglia
>> Vfx and Production Supervisor
>>
>> mobile  +39 347.82.12.473
>> e-mail   f.paglia.80 at gmail.com
>>
>>
>> _______________________________________________
>> Bf-compositor mailing list
>> Bf-compositor at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-compositor
>>
>>
>
> _______________________________________________
> Bf-compositor mailing list
> Bf-compositor at blender.org
> http://lists.blender.org/mailman/listinfo/bf-compositor
>
>


-- 
Francesco Paglia
Vfx and Production Supervisor

mobile  +39 347.82.12.473
e-mail   f.paglia.80 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-compositor/attachments/20140405/1ad342f4/attachment.htm 


More information about the Bf-compositor mailing list