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: Problems with tga and blending

  1. #1
    Intern Newbie
    Join Date
    Oct 2004
    Posts
    30

    Problems with tga and blending

    Hello,

    I've a little question..
    I'm trying to draw the leaves of a tree but I have a problem (with blending maybe).
    The leaves texture is a .tga with transparency.
    When i draw only one quad it's OK. the problem appears when drawing more than one quad..
    Aparently, the last one to be drew mask the other one behind. (The part transparent replace what was behind)

    I don't know how to explain it but you can find a screenshot of the problem just under :
    http://www.imagehosting.us/index.php...&ident=1691043

    T = transparent texture (tga)
    B = black texture (tga)

    B (behind) + T (front) => T (transparent because T replace the colors behind by "transparency")
    T (behind) + B (front) => B (result is black)

    Anyway to resolve this problem ?

    Hope you can help me soon :-),
    Thanks everybody,
    Lud2k.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    748

    Re: Problems with tga and blending

    You sir just ran into one of the most classical bugs when it comes to transparency, the thing is even though the texture is transparent, it still draws to the z buffer as if it was fully opaque thus blocking out everything behind it if it's rendered after the transparent polys.

    there are two ways of fixing this, none of them are perfect.

    1. render all fully opaque polygons first, then render the transparent ones sorted back to front, this looks good, but uses up lot's of CPU and is complicated to say the least.

    2. Use alpha testing, works well but gives jagged edges, this one if the most commonly used.

  3. #3
    Intern Newbie
    Join Date
    Oct 2004
    Posts
    30

    Re: Problems with tga and blending

    Coool it's working :-)

    Thanks for your help zeoverlord !

    I used alpha testing and now it works great ^^

Posting Permissions

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