Hi ivan

1-(1-0.52)^3.137169 = 0.9
1-(1-0.4)^3.137169 = 0.798617
1-(1-0.2)^3.137169 = 0.503434

In other words given an accumulated alpha and a target alpha, you can
calculate one exponent that can then be applied to every sample as above.

Colin
 On 18 Dec 2013 01:10, "Ivan Busquets" <[email protected]> wrote:

> Hi,
>
> Sorry for the repost. I sent this to the development list yesterday, but
> posting over here as well to cast a broader net.
>
> Has anyone dug around the "target input alpha" option in the DeepRecolor
> node, and has some insight on how it is retargetting each sample internally?
>
> Long story short, I'm trying to implement a procedure to re-target opacity
> of each sample in a deep pixel, akin to what's happening in a DeepRecolor
> node when "target input alpha" is checked.
>
> I've got this to a point where it's working ok, but I think I might be
> missing something, as my results differ from those you'd get in a
> DeepRecolor.
>
> My re-targetting algorithm is based on the assumption that the relative
> opacity between samples should be preserved, but DeepRecolor clearly uses a
> different approach.
>
> Example:
>
> Say you have a deep pixel with 2 samples, and the following opacities:
>
> Samp1 :   0.4
> Samp2 :   0.2
>
> The accumulated opacity is 0.52  (Samp1 over Samp2). Note that Samp1
> deliberately has an opacity of 2 times Samp2.
>
> Now, let's say we want to re-target those samples to an accumulated
> opacity of 0.9.
>
> What I am doing is trying to calculate new opacities for Samp1 and Samp2
> in such a way that both of these conditions are met.
>
> a) Samp1 == 2 * Samp2
> b) Samp1 over Samp2 == 0.9
>
> This gives me the following re-targeted values:
>
> Samp1 :   0.829284
>
> Samp2 :   0.414642
>
>
> I'm happy with those, but it bugs me that DeepRecolor throws different
> results:
>
>
> Samp1 :   0.798617
> Samp2 :   0.503434
>
> Which meets the second condition (Samp1 over Samp2 == 0.9), but does not
> preserve the relative opacities of the original samples.
>
> It seems to me like DeepRecolor is applying some sort of non-linear
> function to apply a different weight to each of the original samples, but I
> haven't been able to figure out the logic of that weighting, or a reason
> why it's done that way.
>
> Does anyone have any insight/ideas on what DeepRecolor might be doing
> internally?
> Or a reason why you might want to distribute the target alpha in a
> non-linear way?
>
> Thanks in advance,
> Ivan
>
> _______________________________________________
> Nuke-users mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to