Thanks Steve,

In this case, I'm talking opacity only.

Color values seem to follow the same logic as non-retargeted recoloring.
That is, divide by the input alpha, and multiply by each sample's alpha.

It's the re-distributed alpha values that I can't find the secret sauce for
:)




On Mon, Dec 16, 2013 at 12:29 PM, Steve Booth <st...@boothsoft.com> wrote:

> Ivan,
>
>
>
> The luminance equation comes to mind:
>
>
>
>                 Y = 0.2126 R + 0.7152 G + 0.0722 B
>
>
>
> I'm wondering if the Recolor is trying to maintain essentially the same
> luminance during the recolor operation.  Thus, for example, if you are
> shifting to the blue, you might actually want a higher opacity?
>
>
>
> Just a guess...
>
>
>
> Steve
>
>
>
>
>
> *From:* nuke-dev-boun...@support.thefoundry.co.uk [mailto:
> nuke-dev-boun...@support.thefoundry.co.uk] *On Behalf Of *Ivan Busquets
> *Sent:* Monday, December 16, 2013 12:18 PM
> *To:* Nuke plug-in development discussion
> *Subject:* [Nuke-dev] How is DeepRecolor distributing a target opacity
> amongst samples?
>
>
>
> Hi,
>
> Not strictly a development question, but I figured there would be a better
> chance of someone in this list knowing what's happening under the hood here.
>
> 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 Samp1 == 2*Samp2 and 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 Samp1 over Samp2 == 0.9 criteria, 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,
>
> Ivan
>
>
>
>
>
> _______________________________________________
> Nuke-dev mailing list
> Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
>
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to