I'm assuming that the last texture unit (tu[3]) represents the alpha
channel. I have not tried this specific code. But I do something similar in
another project. Let me know if it works :)

TextureAttributes ta = new TextureAttributes();
ta.setTextureMode(ta.COMBINE);

// Keep the color the same as it was
ta.setCombineRgbMode(ta.COMBINE_REPLACE);
ta.setCombineRgbSource(0, ta.COMBINE_PREVIOUS_TEXTURE_UNIT_COLOR);

// Replace the alpha with the texture's alpha.
ta.setCombineAlphaMode(ta.COMBINE_REPLACE);
ta.setCombineAlphaSource(0, ta.COMBINE_CONSTANT_COLOR);
ta.setCombineAlphaFunction(0, ta.COMBINE_SRC_ALPHA);

tu[3].setTextureAttributes(ta);

-Stoney
----- Original Message -----
From: "Ben Moxon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 09, 2002 8:41 AM
Subject: Re: [JAVA3D] Running greyscale textures into colour/alpha channels


> I can see how that will work with setting the colour- what setting to I
have to use (in TextureAttributes.setTextureBlendColor() I'm guessing ) on
the alpha-channel to use the black -> white element of the image for alpha
as well as the colour channel?
>
> -ben
>
> -----Original Message-----
> From: Artur Biesiadowski [mailto:[EMAIL PROTECTED]]
> Sent: 09 October 2002 11:14
> To: [EMAIL PROTECTED]
> Subject: Re: [JAVA3D] Running greyscale textures into colour/alpha
> channels
>
>
> Ben Moxon wrote:
> > How would I go about mixing several textures so that each one fills a
colour channel and the alpha channel?
> >
> > I have created an array of TextureUnitStates, one for each texture, and
they are all drawing correctly but each texture is in a grey_scale/alpha
format and what I want is for texture1 to be red_channel/alpha,  texture2 to
be green_channel_alpha and so on, blending them all so I get a white centre
and a mix of other colours around the edges where they merge.
>
>
> Use BLEND mode + set constant blend color to correct channel on each
stage.
>
> Never done this, but it should work this way.
>
> Artur
>
>
===========================================================================
> 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".
>

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