> > What's the easiest way to load a greyscale texture and use it as a
> > transparency map on a surface that has no inherent color?

> Well I've got the same problem recently for other reasons. I wasn't sure
> if LUMINANCE as Texture setting, CHANNEL_8 as ImageComponent2D setting
> and GRAY_SCALE as BufferedImage would actually result into a Alpha
> texture. So I changed it to RGBA8, RGBA8 (instead I think you could
> also use Alpha only have to look up that in the API-Docu) and ARGB. You
> can get
> the AlphaRaster from the BufferedImage and set an alpha for each pixel
> according to the luminance of your color channel. And for texturing you
> have to set COMBINE_MODE (assuming you're using 1.3beta1) then you can 
set
> AlphaCombine to replace with Texture_Alpha  and RGBCombine to REPLACE 
with
> OBJECT_COLOR.

Thanks for that � but I found an easier way but it is a bit odd.

1) I changed to using a .PNG as someone suggested. 

2) In photoshop I copied the "RGB" channel (of the grayscale image) to 
the Alpha channel

3) Set the RGB channel to all white pixels. Saved the image as grayscale 
PNG.

4) In Java3D just load the texture and set the appearance's transparency 
attributes to use BLEND_ONE, set the texture mode to BLEND, and set the 
BlendColor to the colour you want � i.e. white in my case.

The result is a transparent texture exactly like that I loaded.

HOWEVER!

There are some strange things here:

1) If you do not set the BlendColor you do not get the right output. I 
don't understand this because the image contains all white pixels in the 
RGB channel. If I don't set the BlendColor I get a transparent black 
circle � but in my source image file it is white. So I have to set 
BlendColor to white which obviously sucks a bit! Any ideas why?

2) Obviously this is slightly wasteful if all you want is an alpha 
channel texture � it has a greyscale channel too. I don't know if it is 
possible to create such a texture without fiddling around with 
BufferedImage(s) etc. as you describe. Saying that, having a greyscale 
channel too could give some interesting effects too � but I'm not sure 
that it is even looking at the grayscale channel right now.

Is there a good Java3D transparency/blend tutorial anywhere? I sure as 
hell haven't found it...

Cheers

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