We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Alpha Mapping Transparencies
Page Index Toggle Pages: 1
Alpha Mapping Transparencies? (Read 697 times)
Alpha Mapping Transparencies?
Feb 14th, 2010, 10:21pm
 
Hey guys,
does anyone know how to alpha map transparencies? Im using it for a game where there needs to be multiple lights (transparent gradients) that can clip together without having the edges.
...
Re: Alpha Mapping Transparencies?
Reply #1 - Feb 14th, 2010, 10:47pm
 
you can simply create and load some pngs with transparencies. Thats how i do it. but it you want to use an alpha map image try out http://processing.org/reference/PImage_mask_.html
Re: Alpha Mapping Transparencies?
Reply #2 - Feb 14th, 2010, 10:53pm
 
no i realize that, but how exactly would you do it? my .png files gradient from full alpha to black, yet when 2 of them clip eachother the black edges cover eachother
Re: Alpha Mapping Transparencies?
Reply #3 - Feb 15th, 2010, 12:45am
 
One way is to have 2 images (same size) the first image is what you want to draw and the second defines the level of transparency these are then combined to give pixel level transparency.

This is the approach I used in a Sprite library I created. You could either use this library or if you want to do your own coding look at the constructors in the Sprite class for this library to see how it is done.

Just looked at the link in Cedric's responce and thats probably an easier way of doing it - Ah well I have been using Processing for over a year and I am still have things to learn about it! Smiley
Re: Alpha Mapping Transparencies?
Reply #4 - Feb 15th, 2010, 1:11am
 
IIRC, you have to use PGraphics in JAVA2D mode to fully use image transparency.
Not sure if that's your problem, as you show no code. At least, it is worth trying...
Re: Alpha Mapping Transparencies?
Reply #5 - Feb 15th, 2010, 10:20pm
 
Ok I got it working!
Thanks guys for the help.
Sorry if it was a dumb question  Wink
Page Index Toggle Pages: 1