SharpT
SharpT

Reputation: 33

artifacts (seams) seen in translucent polygon with holes in openGL

I have this polygon with a hole when rendered in translucent color in openGL, it shows some sort of artifacts along seams of tessellated triangles (by GLUtesselator). This is a bit of strange because the same polygon would not have such artifacts if it's drawn in opaque color.

Artifacts seen as doted line extended from inner circle to outer boundary of polygon:

img

More artifacts seen in interior of the polygon:

img

It appears like bleeding from alpha blending of color between two adjacent triangles' edges. But I have no idea of how to mitigate the problem.

Has anyone seen this problem before? or can someone point out what the problem might be and a possible solution for me?

Upvotes: 1

Views: 621

Answers (1)

Yakov Galka
Yakov Galka

Reputation: 72519

OpenGL guarantees that drawing two triangles that share an edge will produce each covered fragment exactly once, thus you could render artifact-free translucent polygons.

However, this guarantee holds only if both vertices of that edge are identical between the two triangles. Also it won't hold if you anti-alias your polygons with GL_SMOOTH_POLYGON.

It's hard to tell what's the case here without seeing the relevant code, but I would definitely check the coordinates of the vertices of the shared edges to see if they are the same.

Upvotes: 4

Related Questions