Re: [Paracomp-devel] Standard Alpha Blending problems
Brought to you by:
shreekumar
|
From: James S P. <jam...@ma...> - 2008-06-26 12:52:38
|
Hi Shree, Shree Kumar wrote: > Hi James, > > James S Perrin wrote: >> Shree Kumar wrote: >> This is what we don't understand. If presumably intermediate images >> generated from an over operation will be used in a subsequent operation >> and therefore the alpha needs to be maintained. >> >> If you have input images F0-3 then lets assume F0 OVER F1 and F2 OVER F3 >> producing intermediate images iF0 and iF1 to produce the final composite >> we need iF0 OVER iF1 however if Alpha is not preserved by the >> operator iF0 and iF1 will not have the correct alpha values for the >> final operation? >> >> I0 + I1 I2 + I3 <-- correct Alphas >> \ / \ / >> iF0 + iF1 <-- incorrect Alphas? >> \ / >> Output <-- incorrect image? >> > > Your conclusions about "incorrect Alphas" and "incorrect image" are spot > on. Alpha values you get out of the operation from Paracomp will not be > correct. > > If you use ParaComp to do (I0+I1+I2+I3) in one swoop, then you'll get > the right image, but wrong alpha values again. We're not using the final resultant alpha. But to me it seems necessary to preserve it throughout the compositing procedure since only two inputs can be composited in a single OVER operation. > The right thing to do seems to be to fix Paracomp. Will changing > ParaComp's blending function from the current (faulty) equation > > glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) > > to an equivalent of > > glBlendFuncSeparateEXT( > GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, > GL_ONE, GL_ONE_MINUS_SRC_ALPHA); > > work for you ? > > Currently, I don't see anybody using the broken alpha value. So I see it > safe to fix this. Fixing this won't break existing apps either... Looking a the code in compositecpu.cpp we're confused again as it actaully looks like more like glBlend(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); as the src values are not mutliplied by SRC_ALPHA? >> I forgot to say we also see that translucent parts of the front image >> that are composited against "nothing" in the rear image are being >> attenuated. > > That's interesting. Could be a bug. I'll look at this. Images, if you > can send them, will be useful. This has been sorted. Blending was enabled in old code that was trying to support coloured backgrounds, similar to what Stefan has talked about, when the frameresult was passed to gldrawpixels. Anyway the RGBA images are attached. I haven't tried the gimp thing yet. Regards James -- ------------------------------------------------------------------------ James S. Perrin Visualization Research Computing Services The University of Manchester Kilburn Building, Oxford Road Manchester, M13 9PL t: +44 (0) 161 275 6945 e: jam...@ma... w: www.manchester.ac.uk/researchcomputing ------------------------------------------------------------------------ "The test of intellect is the refusal to belabour the obvious" - Alfred Bester ------------------------------------------------------------------------ |