The appearance code listed below worked for my transparent texture
purposes. The key for me was setting the alpha test function in the
RenderingAttributes to NOT_EQUAL and setting the alpha test value to 0.
The texture I used was a transparent GIF created with the Gimp.
It may not be the most efficient, but after struggling for an entire day
with transparency attributes and materials, this solution (which uses
neither of those) worked well for my low poly scene.
I hope it helps.
Cheers,
alan
----
// my appearance code for transparent textures:
Appearance appearance = new Appearance();
PolygonAttributes polyAttrib = new PolygonAttributes(
PolygonAttributes.POLYGON_FILL,
PolygonAttributes.CULL_NONE, 0.0f);
appearance.setPolygonAttributes(polyAttrib);
// Set up texture attributes
TextureAttributes texAttrib = new TextureAttributes();
texAttrib.setTextureMode(TextureAttributes.REPLACE);
appearance.setTextureAttributes(texAttrib);
TextureLoader texLoader = new TextureLoader(texFileName,
Texture.RGBA, this);
Texture tex = texLoader.getTexture();
appearance.setTexture(tex);
RenderingAttributes ra = new RenderingAttributes();
ra.setAlphaTestFunction( RenderingAttributes.NOT_EQUAL);
ra.setAlphaTestValue(0.0f);
appearance.setRenderingAttributes(ra);
// end of appearance code
----
-----Original Message-----
From: Chris Fenton [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 7:14 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Help with transparent textures please :)
Two hings to consider:
1. Your blending is currently setting them to compltely opaque. Of
course you could be using vertex colors with alphas, so I am not sure.
But if you are depending on the transparency attributes then you should
set this to something less than 1.
> Tried NO EFFECT
2. The lowest granularity of transparency sorting in Java3d is the
geometry array. So if you are putting all your geometry into one array
then it will not be sorted.
>WHAT?? i have n-dimensional polygons should I make each face a
different greometry array ??? Ouch
3. If you are overriding the bounds on the objects such that all the
bounds are the same then there will be no effective sorting.
> I have not set object bounds, nor do I know how ?
========================================================================
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA3D-INTEREST". For general help, send email
to
[EMAIL PROTECTED] and include in the body of the message "help".
==========================================================================To
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".