Re: Alphablending
- From: "//\\\\o//\\\\annabee <Free" <Software>>
- Date: Sat, 29 Apr 2006 01:40:20 +0200
På Sat, 29 Apr 2006 00:07:46 +0200, skrev jukka@xxxxxxxxxxxx <jukka@xxxxxxxxxxxx>:
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.
Ok. I cant see it. But you seem to know what you are doing.
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.
Okey. Now I understand a bit better. So I am slow. you actually use the alfa channel within the picture itself for storing alfa values?
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.
Ok, but when I do this in memory, my images does not use any alfa in the imagedata itself. Is it absolutly needed? Does it speed things up? offer more options? I am not sure I understand why you need alfa values inside the image data.
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. :)
Ok. So you have two (3) alfa inputs. One in the image(s) it/themself? and one "global" (constant) modulator? Ok. This makes more sense then. Because I then use only the gobal modulator, since I apply the same function to each pixel. Is this somewhere near correct?
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.
Okey. I think I understand more fully now. Thanks. You have actually a PER PIXEL alpha. whereas what I use, in my code is a PER IMAGE alfa. but I guess this can be worked in.
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.. :)
:) Sound like lots of fun. Thats why I wanted to do such things.
Anyway, I reuploaded a new version of my version of your demo, with 16 leaves. This creates a sort fo nice "snake" like effect. On my 32 bit AMD XP I can get around 64 simultanius sprites. (GDI), But after that its starts getting heavy. I have modified the source so that the number of sprites can be selected by setting the variable "MaxSprites"
To find this in the RosAsm source, write it, and doubleclick it. I am saying this for any other readers, that they can test how many sprites their machine will allow for, under GDI. Theese sprites are quite large.
< http://www.szmyggenpv.com/downloads/LeafONBk.Zip >
.
- Follow-Ups:
- Re: Alphablending
- From: jukka@xxxxxxxxxxxx
- Re: Alphablending
- References:
- Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: hutch--
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: Chewy509
- Re: Alphablending
- From: Dunny
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: silk.odyssey
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: Dunny
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: Dunny
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: jukka@xxxxxxxxxxxx
- Re: Alphablending
- From: jukka@xxxxxxxxxxxx
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: jukka@xxxxxxxxxxxx
- Re: Alphablending
- From: //\\\\o//\\\\annabee <Free
- Re: Alphablending
- From: jukka@xxxxxxxxxxxx
- Alphablending
- Prev by Date: Re: Alphablending
- Next by Date: Re: Alphablending
- Previous by thread: Re: Alphablending
- Next by thread: Re: Alphablending
- Index(es):
Relevant Pages
|