Results 1 to 7 of 7

Thread: Stripes on a transparent object

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2010
    Posts
    21

    Stripes on a transparent object

    When I load one or more partly transparent object i get the following screenshot. The effect changes as I move around objects, sometimes stripes disappear (e.g. for the far ball), and with other camera angle appear again (see image).



    What might be a reason of this effect?
    Opaque objects always look fine.

    ps. I use shaders, made I made a bug in there?

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: Stripes on a transparent object

    In case of transparency, you need to sort the objects in depth order.
    Regards,
    Mobeen

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2010
    Posts
    21

    Re: Stripes on a transparent object

    Yes, i do sort them.
    However, this effect appears no matter I use sort or not.

  4. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,673

    Re: Stripes on a transparent object

    You also need to make sure backface culling is on and that your triangles all have the proper orientation.

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

    Re: Stripes on a transparent object

    Quote Originally Posted by mobeen
    In case of transparency, you need to sort the objects in depth order.
    To be more precise, all triangles should be sorted to avoid this.
    It is simpler to do as said Alfonse, use backface culling so that all convex objects will not need full sort.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    258

    Re: Stripes on a transparent object

    Sorting makes baby jesus cry.

    Just draw the transparent object with colour writing disabled (to fill the depth buffer), then draw again normally over the top caring to use GL_LEQUAL. This will ensure only the front polys are drawn and u don't get this crazy artefact. For multiple overlapping transparent object, sigh you may need to sort those, unless you use weighted average order independent transparency or something.

  7. #7
    Junior Member Newbie
    Join Date
    Oct 2010
    Posts
    21

    Re: Stripes on a transparent object

    Oh, thanks a lot!
    I just switched on the backface culling. It was so easy...

Similar Threads

  1. How to render a transparent textured object
    By lucafr in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-05-2008, 12:49 PM
  2. transparent object
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-09-2003, 04:13 AM
  3. the transparent object with light
    By ding in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 02-25-2002, 05:08 PM
  4. Stange semi-transparent object
    By zoldar256 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 08-03-2001, 02:40 PM
  5. Transparent object Problem
    By Lobo86199 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-27-2000, 02:37 PM

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