Re: Alphablending



I did not notice any partly transparency in your rendering.

You WILL notice lack thereof in your version. Put the edge of the leaf
over the red areas in the background picture. You will notice black
"seam" in some pixels. In my version there is *always* partial
translucency.

It looked just like plain Transparence to me. It still does.
So therefore I went for colorkeying to avoid the extra cycles.

Nope. The picture that I am using does not make the effect so apparent,
feel free to modify the *alpha* of the texture so that it does not have
most values close to 0 or 255. Try 60 to 180 and observe what happens,
127 would mix 50% background color and 50% sprite color.

Ok. What level of Alpha is used in your sample then?
The source says :

alphablend::setAlphaConstant(255,255);

That is CONSTANT alpha, my code is slightly more flexible than the
fixed blending in OpenGL at the time I wrote the code. The two alpha
"weights" there modulate the source and destination alpha before
blending. Thus, I can also "fade" sprites in and out without actually
touching the alpha of the background picture, or the source sprite's
alpha.

Since I am not interested in that, I set the constant alpha to maximum
(255). This *disables* the modulation with the constant alpha. This was
extra "complexity" or maybe "flexibility" that I didn't see important,
now you know what it was for, very perceptive to notice and ask about
it. :)

if you did alpha? Or if wrong, please explain what happens?

What happens, is that I mix the background and sprite color using the
sprite picture's alpha channel as factor how much I interpolate between
the two colors. The equation is quite clear on what is happening.

More fun effects are possible, for instance I could change the blending
function "on fly", maybe adding keyboard toggles to test different
blending functions, it used to be fun when playing around. Another
cheap trick is to have two buffers and mix them to previous so that old
color is *0.85 and new color is *0.15, this creates interesting "motion
blur" -like effect. Everything that is moving will leave a trail.. :)

.



Relevant Pages

  • Re: Alphablending
    ... over the red areas in the background picture. ... feel free to modify the *alpha* of the texture so that it does not have ... you actually use the alfa channel within the picture itself for storing alfa values? ... On my 32 bit AMD XP I can get around 64 simultanius sprites. ...
    (alt.lang.asm)
  • Re: IDirect3DSurface9 and alpha channels
    ... Run DXCapsViewer on this card. ... of hardware blending it offers (frame buffer alpha and texture stage ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: IDirect3DSurface9 and alpha channels
    ... textures rendering, then rest assured it doesn't support alpha blending at ... > Now as far as your question about the images and their alpha channel, ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: D3D: Qberschneidende_Grafiken?=
    ... Bei korrekter Transparenz führt an dem Sortieren kein Weg ... > Transparenz mit Alpha Kanal in der Textur und Alpha ... Mit Alphakanal direkt in der Textur ... Bei der Alpha Blending (er heißt ja Alpha Blending, ...
    (microsoft.public.de.german.entwickler.directx)
  • Re: SGI using ATI Chips?
    ... OpenGL, and mipmapping is definitely supported. ... The only reason I can see why alpha blending isn't supported, is, ...
    (comp.sys.sgi.misc)