How to make objects in the foreground block objects in the background in 3D

edited January 2017 in GLSL / Shaders

I am trying to draw an object in 3D, using the P3D renderer, but many surfaces are being drawn in the wrong order, despite depth test and depth sort being enabled. I am getting a picture like this:

Screen Shot 2017-01-11 at 6.01.53 PM

There does not seem to be any logical explanation for the draw order being used, can someone please explain how to fix this?


  • Are those polygons or just lines you are drawing? That just looks like a wireframe bowl which obviously isn't going to occlude things further away.

    Post the code.

  • edited January 2017

    They are polygons.

    If you look carefully, you can clearly see that things are being occulted, but in the wrong order. I found some information that said it might be a problem with my graphics card, which is an Intel Iris 1536 MB.

    You can also see this with the green axes, which are only be occulted by the the sections which are supposed to be behind them.

  • Also in things like this:

    Screen Shot 2017-01-12 at 11.01.46 AM

  • Actually, this was a problem with how we are looking at that image. Turn it upside-down, and you will see what it actually looks like.

  • edited January 2017

    So this question is resolved?

    In Processing y is 0 at the top of the screen and increases as you move down the screen -- this can seem "upside down" when coming from other graphics coordinate systems.

Sign In or Register to comment.