PDA

View Full Version : Using the alpha channel in textures



JustinVoshell
10-12-2000, 01:02 AM
I am having difficulty getting the alpha channel to work in textures. I define the texture in the GL_RGBA format. The colors come out perfectly, except for the alpha (everything is opaque). Blending is enabled... I'm pretty lost here.

Any Ideas?

Thanks in advance!
Justin Voshell

edotorpedo
10-12-2000, 01:10 AM
Hi,

- Did you make sure you blended as GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPA ? I posted a demo of an RGBA textured cube on my site (home.conceptsfa.nl/~fredo , I hope it is up to date) although this is VB-programmed.

- Did you make sure the alpha -channel you loaded has value 0-255 in stead of 0-1?

- Lighting correct ? Normals correct ?

Otherwise post some code so I can see whats wrong

Edo

JustinVoshell
10-12-2000, 07:05 AM
Hi,

Why should the alpha value be from 0-255 instead of 0 - 1? and since all my values are less than one, shouldn't I see some transparency anyway?

(I will post some code in a few minutes).

Justin Voshell

Bob
10-12-2000, 07:20 AM
The range depends on what type of data you use. If you store alpha as integers, they should be in the range [0,255], where 255 is opaque. If you store alpha as floats, it should be in the range [0.0, 1.0], where 1.0 is opaque.

And as far as I understand, neither normals nor lightning should affect the way the alpha channel works.

Another problem with alpha channels is that you have to draw then in a specific order. You have to draw them from back to front, i.e. the triangles further away before the nearer triangles.