Transperant Textures / Billboarding? (cont)

By “manually create an alpha channel” I think he means this:
At the moment I guess you’re loading your image into an RGB bitmap - one with 3 bytes per texel, 1 each for red, green, blue. Instead you need an RGBA bitmap, with an extra byte per texel for alpha making 4 bytes per texel total.

Load the color components as normal, then check to see whether they match your “invisible” colour. If they do, put 0 in the alpha byte. Otherwise, put 255 in the alpha byte. (I think Nate got these the wrong way round.)

Alpha represents the “opacity” of a texel; 255 is fully opaque, 0 is fully transparent. It’s a lot like generating a blitter mask on the 'Miggy, except that it can do partial transparency rather than just on/off, and the alpha is stored together with the colour info, rather than separately. (i.e. texel data is chunky rather than planar - be thankful!)

Mike C.

Great I seem to have this working 95% now. The problem now is the underlying polygons color seems to show itself through the transperant parts of the texture map. Im not sure what to do here

Thanks

Dan

Sounds like you’re texture mapping with GL_MODULATE mode for glTexEnv, which is affected by the underlying polygon colour. I don’t have the GL spec handy at the moment - I’ll have a look tonight - but maybe try using GL_DECAL instead?

Note that people generally use GL_MODULATE with a white “undercoat” to achieve vertex lighting for textured polys. With GL_DECAL you won’t get this, but for billboarded trees you shouldn’t be using vertex lighting anyway.

Okay, we’ve sorted this one out by email. Just in case anyone else was wondering, it needed a glTexEnv mode of GL_REPLACE.