Results 1 to 5 of 5

Thread: Question about trees (transparent textures)

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    colorado
    Posts
    18

    Question about trees (transparent textures)

    I implimented some standard trees with the 2 perpendicular quads, using a transparent PNG for the tree texture.

    Now, the tree in the foreground correctly shows the transparency through to the skybox, but obscures the other trees like a "cloak of invisibility". But it only does this when viewing the trees from *one direction*, not the other.

    The trees are all part of the big "world" object. I am using glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA). Face culling is off.

    I must be missing something regarding transparent texturing.. this effect is kinda cool but not the simple thing I'm doing after! Any ideas?

  2. #2
    Senior Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    356

    Re: Question about trees (transparent textures)

    When you draw transparent object you have to order them back to front to have a correct behavior.
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    colorado
    Posts
    18

    Re: Question about trees (transparent textures)

    A ha. I was afraid that might be the case.

    But, what about the fact that a tree can also obscure itself? How would I depth sort the 2 quads which make the tree? Their centroids would be equal.

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Question about trees (transparent textures)

    You can mitigate zbuffer problems by doing alpha testing on top of blending, at a low threshold.
    Or use coverage alpha with multisampling.

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    colorado
    Posts
    18

    Re: Question about trees (transparent textures)

    Yes, alpha test will work just fine for my purposes. Thanks for mentioning it.

Similar Threads

  1. Transparent textures
    By fatquack in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-13-2008, 08:43 AM
  2. Transparent Textures
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-04-2005, 08:06 AM
  3. Transparent Textures
    By Azazel in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 01-16-2004, 12:23 AM
  4. Transparent Textures
    By mike_p in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-18-2002, 06:35 PM
  5. Transparent Textures
    By Reb_Crush in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-16-2001, 03:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean