Results 1 to 5 of 5

Thread: Weird overlap effect

  1. #1
    Member Newbie
    Join Date
    Mar 2012
    Location
    Devon, England
    Posts
    40

    Weird overlap effect

    When I enable depth testing in my program I get this weird overlap effect. I gather it's something to do with blending but I don't know much about texture blending.
    http://i.imgur.com/vBAtP.png
    In the picture examples of my problem are circled.

    Any help is much appreciated!
    Thanks,
    Rowan.

    PS: As you can tell from the picture my top down tree sprites are awful. Do you know where I can get some the look decent.
    Help Me [img]<<GRAEMLIN_URL>>/smile.gif[/img]

  2. #2
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896
    Looks to me as if your transparent objects are writing to the depth buffer and/or are not rendered from back to front.

  3. #3
    Member Newbie
    Join Date
    Mar 2012
    Location
    Devon, England
    Posts
    40
    Why shouldn't a transparent object write to depth buffer? How else am I meant to change the drawing order without major changes to my code?
    Help Me [img]<<GRAEMLIN_URL>>/smile.gif[/img]

  4. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,678
    Why shouldn't a transparent object write to depth buffer?
    Because then the algorithm doesn't work.

    If you draw something transparent into the depth buffer, and then draw something (transparent or opaque) behind it, OpenGL will dutifully not draw it at all.

    OpenGL only knows about the triangle it's currently rendering and the framebuffer. It doesn't know what has been rendered "transparently" before.

    This is a common, well-understand thing about transparency via blending. You must render all transparent objects last. You must turn off depth buffering, and you must sort transparent objects back-to-front. There is no other way to handle this.

  5. #5
    Senior Member Regular Contributor uwi2k2's Avatar
    Join Date
    Mar 2011
    Posts
    138

    Blend Func

    Hi,

    just an other idea.
    maybe your blendfunc is not set correctly.

    cu
    uwi
    uwi2k2 - OpenGL Trainer: www.opengl-trainer.com
    ---------------------------------------------------------
    The OpenGL and VULKAN Podcast ( OpenGL2GO ) : OpenGL & Vulkan Podcast
    ---------------------------------------------------------
    timbling.com - Indie TeamUp

Similar Threads

  1. When two bitmaps overlap each other
    By Rong Yao in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-10-2004, 02:24 PM
  2. Weird ghosting effect in textures with some transparency.
    By dodgyposse in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 02-27-2002, 04:45 AM
  3. Replies: 0
    Last Post: 10-30-2001, 09:45 PM
  4. Weird scerrated triangle effect on my meshes
    By dodgyposse in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 06-15-2001, 02:51 AM
  5. Weird effect with OpenGL
    By zenswb in forum OpenGL: User Software
    Replies: 0
    Last Post: 11-29-2000, 04:21 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