Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Larry Gritz
Of course, on that first line, I meant to write "those in imagebufalgo.h". On Jul 13, 2012, at 11:39 PM, Larry Gritz wrote: > The public comments (i.e., those in imagebufalgo) don't need to explain the > algorithms, except as possibly a one-line formula involving only the > pre-multiplied imag

Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Larry Gritz
The public comments (i.e., those in imagebufalgo) don't need to explain the algorithms, except as possibly a one-line formula involving only the pre-multiplied images. E.g., for "over", you might say // The "over" operation is: R = A + (1-A[alpha]) * B and leave it at that. But the

Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Stefan Stavrev
I confirmed from other sources that it only makes sense to use over with blend modes, and other Porter-Duff operations should be separate from blend modes. That makes things so much easier now. Larry, should I write the derivations in the comments for the functions or is it enough to write just th

Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Jeremy Selan
Oh yah, I forgot about that. +1 for matching nuke's screen math (which boils down to max(a,b) if either a or b is outside of 0,1, and screen otherwise. It's less surprising to artists than clamping. -- Jeremy On Fri, Jul 13, 2012 at 10:52 AM, Jonathan Egstad wrote: > fwiw, > Some of the issues

Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Jonathan Egstad
fwiw, Some of the issues with merging HDR pixels have been hashed out in Nuke for a while, so a peek at its Merge node may be helpful: For example 'screen' in Nuke is implemented to avoid the 1-A negative problem: if (A >0 && A<1 && B>0 && B<1) C = A+B - A*B else if (A > B) C = A else

Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Jeremy Selan
Yup. screen = A+B-AB, where AB term represents the if intersection of the subpixel geometry. But in the case where you have two mattes where you know the correlation == -1, (which denotes no overlap in the subpixel geometry), adding mattes reduces to a simple A+B. An example of no overlap in th

Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Larry Gritz
Is that really necessary? The way the doc you sent describes things, the blend modes were always used with "over". Do PhotoShop and others give independent control of blend and composite? Does anybody really need to do "screen + in"? I was thinking that you'd want two separate functions: 1.

Re: [Oiio-dev] Pre-multiplication

2012-07-13 Thread Stefan Stavrev
On second look I think the simplification Larry suggested won't work. There are X number of Porter-Duff operations and Y number of blend modes. If I am doing such simplifications, I will have to do it for each pair (Porter-Duff operation, blend mode), and that would be X = 12, Y = 20, X*Y=240 func