I am trying to use negative alpha blending to make black smoke and I am so close but yet so far. The problem is if I use
ghost object on 1,1 to enable negative alpha blending I cannot fade the object out gradually to make the smoke "dissapate"(sp?). If I use positive alpha blending (using
set alpha mapping on obj,perc) the smoke comes out white no matter what. I would like to be able to use
set alpha mapping on in conjunction with
ghost object on (flag = 1). this would be perfect but it seems the two commands are incompatible. If the object is ghosted using ghost object on then set alpha mapping on has no effect. If I use only set alpha mapping on then the alpha blending is always positive besides the fact that I cannot properly hide the "edges" around my circular smoke texture.
Here's what I got so far:
make object cube 2,5
make object cube 1,10 : color object 1,rgb(0,0,0)
create bitmap 1,50,50
ink rgb(255,255,255),0
box 0,0,50,50
ink rgb(10,10,10),0
for x=1 to 1000
ang=rnd(360)
rad=rnd(20)
dot 25-sin(ang)*rad,25-cos(ang)*rad,rgb(25,25,25)
next x
blur bitmap 1,6
img = 2
get image img,0,0,50,50,1
delete bitmap 1
sync on :sync rate 60
alpha = 50
texture object 1,0,2
ghost object on 1,1
do
yrotate object 1,wrapvalue(object angle y(1)+1)
set object transparency 1,2
if leftkey() = 1 then dec alpha,2
if rightkey() = 1 then inc alpha,2
set object light 1,0
set alpha mapping on 1,alpha
text 5,5,STR$(alpha)
sync
loop
As it stands now, altering the set alpha mapping on percentage has no effect. (Therefore impossible to fade away my smoke objects). comment out ghost object on (line 20) and you can now very smoothly fade the object in and out but obviously the edges are still there.
Anyone have any idea how to do this? If you would like my full source code for my smoke demo just ask and I'll post.
PS sorry for the sloppy code... its been edited and re-edited to death
thanks!