Re: Alphablending



På Fri, 28 Apr 2006 23:57:25 +0200, skrev jukka@xxxxxxxxxxxx <jukka@xxxxxxxxxxxx>:

I am not sure what you reply to but guess it must be me.

No, it does not.

Does not what?

"source" and "destination" are concepts from OpenGL
and D3D ; the source is the incoming fragment and the "destination" is
the alpha value already in the render target.

Source and destination refers to background and foregound image in the docs I read.
The two that are blended into each other producing a 3rd image.
They are not some "concepts" from DirectX or OpenGL.

In this case we are
interested in combining the destination and source color using the
source alpha.

Yes, but that does not say a single thing.

What really happens is that the colors from a source pixel and a destination pixel are weighted, e.g. they are multiplied, each of the components against the alpha value.

say if the alpha is 0.5 and the RGB tripplet is ( 50, 100, 100 )
the result is ( 25, 50 50 )

The same is done to the background, except using (1.0-alfa)

so that if the background is (200, 100, 100) and the alpha is (1-0.5) still, then we end up with a background color of (100,50, 50)

So now that we have multiplied the alfa in, we ADD the colors together.

(25+100, 50+50, 50+50) = (125, 100, 100) and this is the color written to the target at that point. This is done for each pixel.

This pixel will contain half of the foreground, and half of the background.
Any other variation, will yield a mix between the two. Strong background, weak foreground, or visa versa.

There are other ways to combine the colors. But this is what is usually ment by alphablending. I should now, I read 10 papers at least saying the same.




.



Relevant Pages

  • Re: Anti-aliasing in image clipping to non-rectangular sub-images
    ... is that you can't draw alpha into an image. ... you basically can't draw on it (with the ... That will change it to a black pixel with an alpha of 0. ... That does not modify the alpha component of the destination ...
    (comp.lang.java.gui)
  • Re: nonlinear bitmap stretch algorithm
    ... Where s and d are the source and destination dimensions. ... position x,y should get the pixel value in the original image at ... > I'm looking for an algorithm that would do a nonlinear bitmap stretch, ... > amount of stretch increases as you move toward the edges. ...
    (comp.graphics.algorithms)
  • Re: Possible to copy regions?
    ... Then use BitBltto copy the source to the destination. ... Microsoft MVP - Visual C++ ... Source draws a valid bitmap. ... (Right now I am copying pixel by pixel if the pixel falls in the ...
    (microsoft.public.win32.programmer.gdi)
  • Re: loosing alpha chanel when rendering to texture
    ... So the framebuffer did not get overwritten properly. ... blending before clearing screen and turning it on again afterwards made ... My game is running a bit slow, and maybe having this destination alpha ...
    (comp.graphics.api.opengl)
  • Re: in standard C it is impossible to write a correct program. Why?
    ... Alpha is also unconventional in the approach to arithmetic traps. ... arbitrary number of instructions after the instruction that triggered ... significant bits to the destination register. ...
    (comp.lang.c)