implement depth sorting for triangles to fix rendering issues with transparent objects in 3D #90

Closed
processing-bugs opened this Issue Feb 10, 2013 · 11 comments

Comments

Projects
None yet
3 participants
@processing-bugs

Original author: b...@processing.org (June 07, 2010 00:27:42)

This bug automatically added from:
http://dev.processing.org/bugs/show_bug.cgi?id=176

Comment from fry, 2005-10-15 10:27

Objects with alpha (lines or shapes with an alpha fill or stroke, images
with alpha, all fonts) are displayed in OpenGL (and P3D, in fact) based on
their drawing order. This creates some annoying effects like making things
opaque if they're drawn out of order with objects above or beneath them.
This is simply how OpenGL works, but is something that we'd like to develop
a workaround for in the future. Currently, you should just try to draw
things back-to-front as best as possible.

Original issue: http://code.google.com/p/processing/issues/detail?id=51

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From b...@processing.org on June 07, 2010 00:27:45
Comment from fry, 2005-10-15 10:37

Created an attachment (id=27)
sketch that shows the problem

From b...@processing.org on June 07, 2010 00:27:45
Comment from fry, 2005-10-15 10:37

Created an attachment (id=27)
sketch that shows the problem

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From b...@processing.org on June 07, 2010 00:27:46
Comment from fry, 2006-04-19 08:14

implemented basic support via hint(ENABLE_DEPTH_SORT) for revision 114. it won't work for
many cases because it just z-sorts the triangles based on the average z of its vertices. it also
doesn't help lines, which have the same trouble.

the proper fix will be considerably more work:

  • implement newell's algorithm for painter sort (have code for this from a project years ago..
    just need to adapt in a way that'll be fast enough)
  • needs to take into account splitting triangles as necessary
  • need to merge line and triangle rendering, because they need to be sorted relative to one
    another (ugh). this makes for a nasty structural change. without it, it's pretty bad.

From b...@processing.org on June 07, 2010 00:27:46
Comment from fry, 2006-04-19 08:14

implemented basic support via hint(ENABLE_DEPTH_SORT) for revision 114. it won't work for
many cases because it just z-sorts the triangles based on the average z of its vertices. it also
doesn't help lines, which have the same trouble.

the proper fix will be considerably more work:

  • implement newell's algorithm for painter sort (have code for this from a project years ago..
    just need to adapt in a way that'll be fast enough)
  • needs to take into account splitting triangles as necessary
  • need to merge line and triangle rendering, because they need to be sorted relative to one
    another (ugh). this makes for a nasty structural change. without it, it's pretty bad.
@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From b...@processing.org on June 07, 2010 00:27:47
Comment from fry, 2007-12-08 08:32

in some cases, disabling depth testing (hint(DISABLE_DEPTH_TEST)) will also
make textures work properly in either direction, however you'll obviously
lose depth.

From b...@processing.org on June 07, 2010 00:27:47
Comment from fry, 2007-12-08 08:32

in some cases, disabling depth testing (hint(DISABLE_DEPTH_TEST)) will also
make textures work properly in either direction, however you'll obviously
lose depth.

@processing-bugs

This comment has been minimized.

Show comment
Hide comment
@processing-bugs

processing-bugs Feb 10, 2013

From fjen...@gmail.com on August 03, 2011 16:25:34
CC'ing myself

From fjen...@gmail.com on August 03, 2011 16:25:34
CC'ing myself

@ghost ghost assigned codeanticode Feb 11, 2013

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Jun 2, 2013

Member

Properly implementing depth sorting in the opengl renderer would require significant changes, so it cannot be included in the 2.0 release at this point.

Member

codeanticode commented Jun 2, 2013

Properly implementing depth sorting in the opengl renderer would require significant changes, so it cannot be included in the 2.0 release at this point.

@benfry benfry reopened this Jun 2, 2013

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jun 2, 2013

Member

But that doesn't mean it should be closed... It's still an open issue.

Member

benfry commented Jun 2, 2013

But that doesn't mean it should be closed... It's still an open issue.

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Jun 2, 2013

Member

ok, I will just tag it as low priority, as it is not clear when we will able to implement depth sorting in the gl renderers.

Member

codeanticode commented Jun 2, 2013

ok, I will just tag it as low priority, as it is not clear when we will able to implement depth sorting in the gl renderers.

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Jun 13, 2013

Member

Benjamin Van Citters (http://benvancitters.com/) wrote some code to do depth sorting and put it on openprocessing: http://openprocessing.org/sketch/100912, we can look at it to see if it can be integrated into the renderer.

Member

codeanticode commented Jun 13, 2013

Benjamin Van Citters (http://benvancitters.com/) wrote some code to do depth sorting and put it on openprocessing: http://openprocessing.org/sketch/100912, we can look at it to see if it can be integrated into the renderer.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jan 28, 2015

Member

Locking this issue because of multiple comments/queries for help on sketches, rather than contributions to the issue itself.

If you'd like to work on this, please get in touch we me or @codeanticode.

Member

benfry commented Jan 28, 2015

Locking this issue because of multiple comments/queries for help on sketches, rather than contributions to the issue itself.

If you'd like to work on this, please get in touch we me or @codeanticode.

@processing processing locked and limited conversation to collaborators Jan 28, 2015

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Aug 3, 2015

Member

implemented in #3507, #3477, #3410, #3372

Member

codeanticode commented Aug 3, 2015

implemented in #3507, #3477, #3410, #3372

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.