Bug 176 : implement depth sorting for triangles to fix rendering issues with transparent objects in P3D and OPENGL
Last modified: 2009-02-19 19:20




Status:
ASSIGNED
Resolution:
-
Priority:
P3
Severity:
enhancement

 

Reporter:
fry
Assigned To:
fry

Attachment Type Created Size Actions
sketch that shows the problem application/zip 2005-10-15 10:37 9.20 KB

Description:   Opened: 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.
Additional Comment #1 From fry 2005-10-15 10:28
Additional Comment #2 From fry 2005-10-15 10:37
edit]
sketch that shows the problem
Additional Comment #3 From fry 2006-03-08 20:00
*** Bug 302 has been marked as a duplicate of this bug. ***
Additional Comment #4 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.
Additional Comment #5 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.
Additional Comment #6 From fry 2009-02-19 19:20
*** Bug 1115 has been marked as a duplicate of this bug. ***