I have two complex surfaces lying 90 degress to each other and each crossing
at the middle. Each surface has a Texture which includes a transparent
alpha value. I would like the transparent colors of the image to remain
transparent, and the rest opaque, but I am having difficulty achieving this.
The following code is being used to set the transparency:
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode(ta.BLENDED);
ta.setTransparency(0.5f);
theAppearance.setTransparencyAttributes(ta);
If I set the transparency level greater than 0 then the surface becomes
translucent, and I can see 'through' the holes in the texture which are
defined by the textures alpha value (the text is the transparent part of the
image - see 'good.jpg'). This is what I would expect (but not what I
require, because I do not want the surface to be translucent).
If I set the transparency to 0 (i.e. opaque) then I can still see through
the holes in the image, but the first surface masks the second. (see
bad.jpg).
Note that if I do not set any transparency attributes then the texture is
entirely opaque.
Can anyone explain what is happening here?
Andy
bad.jpg
good.jpg