Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Transperant Textures / Billboarding? (cont)

  1. #1
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Brisbane,QLD, Australia
    Posts
    101

    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

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    London
    Posts
    503

    Re: Transperant Textures / Billboarding? (cont)

    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.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    London
    Posts
    503

    Re: Transperant Textures / Billboarding? (cont)

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •