Hi,

A couple of weeks ago, I sent the response below to a similar question
in this group. (The subject line was: '[JAVA3D] Help with transparent
textures please :)')

After struggling with Transparency Attributes and blending modes, I
finally did away with them and used the rendering attributes instead.
Hopefully, the explanation below will help with the transparent gif part
of your question.

As for performance, I'm not sure of the impact because I have a very low
poly, simple scene.

Anyhow, here is the text from my previous post:

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: James Sheridan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2003 7:18 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Transparency Question (Modulation and Ordering)

Hi All,

I've got a transparent gif that I want to use as a texture but I can't
figure out how to make just the transparent section of the gif
invisiable
while leaving the rest untouched - any pointers please?

Also I was wondering how much impact on performance results from turning
transparency sorting on?   If there are only a small number of
transparent
objects which remain relativly static is it best to just use ordered
groups?

Regards - James

========================================================================
===
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".

Reply via email to