On Fri, 21 Jan 2005 01:22:30 +0100, Martijn Sipkema <[EMAIL PROTECTED]> wrote:
> On Wed, 2005-01-19 at 21:29 -0500, Timothy Miller wrote:
> > I did a little more experimentation.  If you have an antialiased line
> > on integer coordinates that's exactly 45 degrees, the center line is
> > alpha 1.0.  Depending on how you interpret "coverage", this is
> > slightly off, because the pixel corners lie slightly outside of the
> > line, so you don't have 100% coverage.  I'm not sure if I've done the
> > math right, but it looks like in that case, the pixel should have 83%
> > coverage.  However, as the line tends toward vertical or horizontal,
> > the given antialias algorithm tends toward expected results, as far as
> > I can judge.
> 
> I think you are right. Lines near 45 degrees angle appear a little
> thick. I also wonder if the algorithm is good enough at the line
> endpoints; it doesn't smooth them.

Yeah, that's the problem.  Well, I'm not absolutely sure that they're
really thick.  I think they look thick because they're too bright.  I
suspect that adding an attenuation function which reduces the center
alpha from 1.0 to something lower, depending on the angle, will solve
the problem well enough.

> 
> > Also, coverage isn't the only way to compute antialiasing, although
> > I'm not sure how much leeway the OpenGL spec gives.  If that's really
> > a problem, we can compute an attenuation factor based on slope.  But I
> > don't think it'll be a problem.
> 
> The OpenGL isn't that strict about how to implement antialiasing. It
> describes the 'ideal' case where exact coverage is square pixels is
> computed, but any implemenation is compliant as long as:
> 
> - a fragment whose coverage is a subset of the coverage of another
> fragment may not have a larger computed coverage than that other
> fragment.
> 
> - the coverage computation may not depend on the fragment's x and y
> value.
> 
> See 3.2 of the 1.5 spec.
> 
> I'm not sure, but I think your method follows condition 1; it certainly
> follows 2.

I think so too.

> 
> The glut program below draws lines at various angles using the method
> you described; it doesn't look bad at all...

Do you imitate what I'm doing by drawing a smooth polygon?  You're not
doing the same math that I'm doing.

> 
> It would be nice to know what algorithm is typically used for
> implementing OpenGL width 1.0 smooth lines in hardware.

I would also like to know that.  Perhaps someone else here can answer
that.  But I suspect that they use one of the standard algorithms.
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)

Reply via email to