Alpha with Textures

  • Follow


I'm trying to paint a texture on to a plane and use that texture's alpha 
and luminance on the plane while still using the plane's original color.  
I load the texture, and then color4f(.5, .2, .2, 1.0), and i want to get a 
texture out that is transparent where the texture is transparent and the 
color the most intense where the texture is the most intense.

For example, I have a blotch of texture thats only a little more than a 
sphere, and I use that as my intensity on my plane, I want the color to 
appear most intense on that blotch, and less intense(or even black) 
elseware.  Moreover, I built a gaussian function for alpha to blend things 
away the further they are from the center of the texture.  So after I 
loaded the image, I tore it apart 32 bit integer by 32 bit integer, pulled 
out the alpha, multiplied it by my gaussian function and shoved it back 
in.  The function works, I've printed out the alpha channel to the console 
and it looks veyr much like it should.

My problem is that none of this seems to work.  I seem to be able to get 
the intensity from my texture, but not the transparency, either my 
textures are only about half transparent, or totally opaque, but not 
totally transparent.  I need these planes to be totally transparent at the 
edges to blend better with one another, but right now all I'm getting is a 
bunch of half transparent planes that obviously look like planes.

My blending function is (GL_ONE, GL_ONE_MINUS_SRC_ALPHA), and my texturing 
functions are

GL_COMBINE_RGB, GL_REPLACE
GL_TEXTURE_ENV_MODE, GL_COMBINE
GL_SOURCE0_RGB, GL_PRIMARY_COLOR
GL_OPERAND0_RGB, GL_SRC_COLOR
GL_COMBINE_ALPHA, GL_REPLACE
GL_SOURCE0_ALPHA, GL_TEXTURE
GL_OPERAND0_ALPHA, GL_SRC_ALPHA

I realize these functions would probably throw out the texture's 
intensity, I wasn't using them when I had the intensity working.  I just 
gave up on everything but getting the alpha to work.

Thanks for anything you can help with,
John

0
Reply AustinWiltshire 7/15/2004 4:33:33 PM

"AustinWiltshire" <jgraham1@Bianca.CS.Trinity.Edu> ???
news:Pine.LNX.4.44.0407151119570.4976-100000@Bianca.CS.Trinity.Edu ???...
> I'm trying to paint a texture on to a plane and use that texture's alpha
> and luminance on the plane while still using the plane's original color.
> I load the texture, and then color4f(.5, .2, .2, 1.0), and i want to get a
> texture out that is transparent where the texture is transparent and the
> color the most intense where the texture is the most intense.

What you are trying to do is to edit only the intensity of the texture, is
it ?
I think you should try to use multi texture : texture & light map.
I think you don't need to use the glBlend function, do it in the
multitexture.

Vincent


0
Reply Vincent 7/19/2004 3:51:52 PM


1 Replies
214 Views

(page loaded in 0.058 seconds)

Similiar Articles:













7/20/2012 3:07:04 AM


Reply: