First, use a PNG or GIF image with an alpha channel transparency for your texture, I've had okay results with both. (Okay, GIF's don't really have an alpha channel, don't flame me).
Then you have to set some attributes in the appearance and texture modes of your 3D shape... here's the code I use, which blends the vertex colors with the texture, so the texture is "lit" properly. I'm doing this in my project, with great results, there's screenshots up at http://vp2.onebigvillage.com , look in the screenshots section, in the 4/10/2002 gallery. The trees in the distance are 2-poly OrientedShape3D objects. Here's quick example for transparency: private void useTransparentTextures(Shape3d shape){ Appearance app=new Appearance(); app=shape.getAppearance(); //modulate the texture with vertex color, results in a properly lit/shaded look TextureAttributes texAtt = new TextureAttributes(); texAtt.setTextureMode(TextureAttributes.MODULATE);//MODULATE app.setTextureAttributes(texAtt); TransparencyAttributes tAtt = new TransparencyAttributes(TransparencyAttributes.BLENDED, 0.0f); //BLENDED app.setTransparencyAttributes(tAtt); shape.setAppearance(app); } Also, when loading the textures, make sure to make it an RGBA texture, like this: String mt = new String("textures\\moon.png"); moonTex=new TextureLoader(mt,new String("RGBA"), this); Scott S. Virtopia 2 3D Project: open beta! http://vp2.onebigvillage.com ----- Original Message ----- From: "Russell Power" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 9:58 PM Subject: [JAVA3D] Transparent object + texture with transparency > Hi, > > Does anyone have a small example of a program that places a transparent > texture onto an shape? I'm having issues similar to those mentioned on the > bug parade( the texture displays correctly, but the shape behind it comes > out black or white and sometimes other things, but never transparent). > All the bugs related to this seem to be closed, but I still can't figure out > how > to make it work! > > I'm trying to use OrientedShape3D's to place trees on terrain - having the > white or black background around them is kind of annoying ;). > > Thanks, > > --russell > > =========================================================================== > 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".