[PD] [Gem] Alpha: transparency only in one direction?

Martin Peach martinrp at vax2.concordia.ca
Wed Nov 30 20:24:04 CET 2005


Roman Haefeli wrote:

>hi
>
>during fooling around with alpha-channel i realized, that transparency
>works only in one direction. i don't know much about opengl, but could
>it be that it is an issue of my gfx-card (ati mobility radeon 9600)?
>it seems that when an object (e.g. a rectangle), that is processed AFTER
>another object is placed (from Gem-perspective) in front of this first
>processed object, it gets transparent with alpha-values < 1. but when
>you rotate the whole thing (180 degree), you have the first processed
>object in front of the second processed object and the obj in front is
>darker, but not transparent.
>
> the attached patch may explains better what i am trying to say.
>
>is there a way to get transparency in all directions?
>  
>
Yes. You have to rearrange the objects into the order in which they will 
be drawn, using some sort of sorting algorithm. There is no other 
way...at least no easier way.
The way openGL does transparency is by drawing over top of previously 
drawn objects and mixing the colours according to the alpha value of the 
closer object. Distant objects must therefore be drawn first. With the z 
buffer turned off, distant objects can still be drawn after the 
foreground objects but they will not appear transparent, so they will 
appear to be floating in front, which looks all wrong.
In alphabehaviour.pd you would have to split the rectangles where they 
join and adjust their drawing order according to the rotation angle. Can 
this be done in Gem?
Martin






More information about the Pd-list mailing list