Different shade of color when using opacity


I am experiencing a weird error regarding opacity.

I am rendering a 3D shape made out of two circles. Each of the circle is made out of several pieces. Every second is flipped. The ones that are fliped get a darker shade of color. I have tried to use hint(ENABLE_DEPTH_SORT) which solves the issue. However, the performance drops drastically. Is there another solution to this problem?

Here are some pictures of what I am talking about: https://imgur.com/a/oC1qO9B. The last picture is with hint(ENABLE_DEPTH_SORT).

Thanks in advance!

@gytis585 – Much is unclear – especially “a 3D shape made out of two circles.” Are they transparent or opaque? Must they have the same depth, or can there be a gap between them? Are then, in fact, circles (rendered with ellipse) or are they PImage or PGraphics?

It seems like you want a high-performance solution, but what kinds of optimizations you can do also depend a lot on many details of your project. For example, must this two-circle shape be free-rotated in real-time? Are the two circles ever intersecting at an angle, or are they always back-to-back?

You might get more feedback and suggestions if you could provide a minimal sketch that demonstrates this problem.