Re: [Paracomp-devel] Crash in pcSystemFinalize
Brought to you by:
shreekumar
|
From: Shree K. <shr...@hp...> - 2008-05-16 10:27:45
|
Hi Max, On Wed, 2008-05-14 at 14:18 +0000, Maxim Makhinya wrote: > I think of alpha as amount of light that goes through the volume > (i.e. transparency), so it is (1-opacity), colors are pre-multiplied > with opacity, when > glBlendFuncSeparate( GL_ONE, GL_SRC_ALPHA, GL_ZERO, GL_SRC_ALPHA ) > is used, it is actually calculates new transparency as > (1-SrcOpacity)*(1-DstOpacity), when GL_SRC_ALPHA used to blend images > on to background that means FinalColor = SrcColor + BG_Color*SrcAlpha > where: SrcAlpha = (1-SrcOpacity) and SrcColor (as I wrote above) > pre-multiplied with opacity i.e. SrcColor = SrcColorOrig*SrcOpacity, > so finally we have: > FinalColor = SrcColorOrig*SrcOpacity + BG_Color*(1-SrcOpacity); > > In the formula above we see SrcOpacity twice, well, actually this is > not the same value because it accumulates in color and alpha channels > separately and it is slightly different due to rounding errors, but > the general idea should be correct =) > Ok got it. So you need the equivalent of glBlendFuncSeparate( GL_ONE, GL_SRC_ALPHA, GL_ZERO, GL_SRC_ALPHA ) as the blending function for images. As I mentioned earlier, Paracomp does the equivalent of glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA). This, unfortunately, won't yield the results you need (in either of the scenarios you mentioned earlier). Right now, it is not possible to pass parameters to the compositor to change the way the pixels are combined. We have a COMPOSITE_ALPHA_SORT operation which combines the pixels in the way I mentioned. Ideally, we should have ways of setting the source and destination factors. This asks for another extension to the API... -- Shree |