|
Author |
Topic: alpha channel stuff (Read 450 times) |
|
trip
|
alpha channel stuff
« on: Sep 6th, 2003, 5:09am » |
|
hey all i have a question about alpha channels please look at my animation at: http://www.negativespace.org/cmendoza/files/alpha now tell me: why aren't the trails dissapearing? i am adding rects that equal the window size with, let's say, an alpha of 10%. My common sense tells me that eventually, these rects should pile on top of each other to add alpha=100%. But then again, common sense!=programming language, mostly because my common sense is sometimes dumb. any help appreciated c
|
|
|
|
flight404
|
Re: alpha channel stuff
« Reply #1 on: Sep 6th, 2003, 8:53am » |
|
I know in past versions, alpha was a little buggy. Not sure if it has been addressed yet. r
|
|
|
|
trip
|
Re: alpha channel stuff
« Reply #2 on: Sep 6th, 2003, 8:07pm » |
|
Is my common sense correct in thinking that eventually the trails would disappear though? I just want to know if I am on the right track, since I am kind of new to graphics programming... c
|
|
|
|
flight404
|
Re: alpha channel stuff
« Reply #3 on: Sep 7th, 2003, 4:48am » |
|
Yeah, your thinking is correct, me thinks. If you swap the colors so that the background is black and the rectangle is white, it should work fine.
|
|
|
|
trip
|
Re: alpha channel stuff
« Reply #4 on: Sep 7th, 2003, 6:48am » |
|
yea, that works... i've been having problems with white and alpha channels when there is no background... the alphas pile on and tend to turn either black or gray c
|
|
|
|
Glen Murphy
|
Re: alpha channel stuff
« Reply #5 on: Sep 13th, 2003, 4:36pm » |
|
Just so you know you're not going crazy, I've had the same 'gets to almost-white but not quite' thing before in non-P5 environments.
|
|
|
|
trip
|
Re: alpha channel stuff
« Reply #6 on: Sep 16th, 2003, 4:39am » |
|
is there something that could be done? i would like to fade to white sometimes... and on another related issue: have you imaged the same bitmap with alpha channel repeatedly one on top of the other? the alpha channel ewventually turns black. which really sucks if your background is white. thoughts? c
|
|
|
|
arielm
|
Re: alpha channel stuff
« Reply #7 on: Sep 16th, 2003, 9:44am » |
|
after a quick look at your code: it seems that the problem arrise because at the end of each frame, you use a rectangle with 10% opacity to clear the screen... as a workaround, i would: 1- use background(255) to automatically clear the screen. 2- at each frame, instead of drawing one point of the sine wave, i would draw the whole sinewave (from the top to the relevant y), with each point having the required opacity. (all this should even work faster, since drawing rectangles with alpha is currently very slow) hth
|
Ariel Malka | www.chronotext.org
|
|
|
benelek
|
Re: alpha channel stuff
« Reply #8 on: Sep 16th, 2003, 6:19pm » |
|
or, you could do a pixel-unpacking exercise, looping through the pixels array and increasing all r/g/b values less than 255 by 1. for instance: Code:for(int i=0; i<pixels.length; i++) { //unpack pixels[i], get individual r/g/b components. //r=min(r+1,255) for each of r, g and b. //put color back together and reinsert into pixels[i] } |
|
|
|
|
|
|