Anti-Aliasing Problem

If you need more code, please tell me what part you need.

When i do the antialiasing, there is a diagonal line that appear in my quad, making it look a bit like 2 triangle, or simoply a diagonal line in my each of my square.

There is a background color.

If i try it without the anti-aliasing, the 2 triangle inside my quad aren’t there.

i have a floor like a check game.

Quad Code


glBegin(GL_QUADS);		// Plancher droit dans son monde.
	glVertex3f(-fDemiLarg + fPosX1, HAUTEUR, -fDemiLarg + fPosZ1);
	glVertex3f(-fDemiLarg + fPosX1, HAUTEUR, -fDemiLarg + fPosZ2);
	glVertex3f(-fDemiLarg + fPosX2, HAUTEUR, -fDemiLarg + fPosZ2);
	glVertex3f(-fDemiLarg + fPosX2, HAUTEUR, -fDemiLarg + fPosZ1);
glEnd();

Anti-Aliasing Code


if(ANTI_ALIASING_ON == (int)a2dCombin[ANTI_ALIASING][VALUE])
{
	//glEnable(GL_BLEND);
	//glEnable(GL_POLYGON_SMOOTH);
	//glBlendFunc(GL_SRC_ALPHA_SATURATE,GL_ZERO);
	//glHint(GL_POLYGON_SMOOTH_HINT,GL_FASTEST);
	//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_MULTISAMPLE_ARB);
}


The hardware renders your quad as two triangles, so that’s were your additional edge comes from.

I had a similar problem a while back, when i did multiple passes using blending to combine them.

The problem was, that i had line-smoothing enabled, which resulted in overlapping pixels at the triangle-edges. Due to blending the values of those pixels were accumulated, which resulted in a visible line.

This didn’t happen on my ATI card, since ATI does not support polygon and line-smoothing.

Disabling polygon- and line-smoothing solved the issue for me.

I didn’t use multi-sampling, though, so i am not sure whether it is the same issue with you, but at least it’s something you can try out.

Hope that helps,
Jan.

If i activate :
Blending and BlendFunc the Triangle shows.
Same ith polygon smooth.

I will try and look at line_smooth se what happens…

When i enable GL_LINE_SMOOTH

The anti-aliasing doesn’t work, and the 2 triangle dissapear.

hmmpff :frowning:

Since when does GL_LINE_SMOOTH affect triangles?

Anyway, I’m still confused by your response:

If i activate :
Blending and BlendFunc the Triangle shows.
Same ith polygon smooth.

So you’re saying that if you have no SMOOTH enabled and just the blending, that you can see the diagonal. this would imply that if you draw a triangle mesh you would see all the edges? Or what do you mean by ‘same with polygon smooth’?

N.

Hmm sorry :

Here :

If nothing enable : No Edge
GlEnabled(GL_LINE_SMOOTH) : No Edge, anti-Aliasing not Working
GlEnabled(GL_POLYGON_SMOOTH) : Edge, Anti-Aliasing seems to work
glEnable(GL_MULTISAMPLE_ARB); : Edge, Anti-Aliasing seems to work
The edge cause a problem to me xD

In any case, when multisample is enabled the X_SMOOTH hints should be ignored according to the specs. So I guess the question is why blending isn’t working correctly with antialiasing, right?

3.5.6 Polygon Multisample Rasterization
If MULTISAMPLE is enabled and the value of SAMPLE BUFFERS is one, then poly-
gons are rasterized using the following algorithm, regardless of whether polygon
antialiasing (POLYGON SMOOTH) is enabled or disabled.

N.

Exactly.

I would love to make anti-aliasing work… in anyway

Did you try out GL_SAMPLE_ALPHA_TO_COVERAGE, GL_SAMPLE_ALPHA_TO_ONE and GL_SAMPLE_COVERAGE?

PS: If it applies, GeForce 6 and 7 series cards cannot perform floating-point blending and multisample anti-aliasing together in hardware.

N.