## antialiasing polygons

honkFactory
Unregistered

Post: #1
Howdy
What is the best way to antialias a set of polygons? I am trying to avoid having to depth sort the polys first because the objects that I will be drawing are going to be rotating constantly.
A.W.
Moderator
Posts: 869
Joined: 2003.01
Post: #2
Quote:Originally posted by honkFactory
Howdy
What is the best way to antialias a set of polygons? I am trying to avoid having to depth sort the polys first because the objects that I will be drawing are going to be rotating constantly.
A.W.

I think you don't need it for FSAA. Otherwise, you must sort.

- D.G
Member
Posts: 145
Joined: 2002.06
Post: #3
I developed a method that works back to the Rage128 using a two-pass process and doesn't require a depth sort. I was originally considering patenting it but I don't think it's very valuable in the current market, so I decided against that. I'll post a brief rundown here when I get back from school today.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
honkFactory
Unregistered

Post: #4
What is FSAA?
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
Full Scene Anti-Aliasing.
Member
Posts: 145
Joined: 2002.06
Post: #6
ok, I got some physics homework due tomorrow so I don't have as much time right now as I would want, but here's the general idea:

data you need before you start:
1. the scene data
2. polygon connectivity graphs for each model in the scene
3. a list of front-facing polygons in the scene

what you do:
1. render the scene as normal
2. with the polygon connectivity and visible face list, find the edges between visible and backfacing edges ("silhouette edges")
3. render this edges as smooth lines

I have working code that does this and only incurs about a 20% performance hit on a rage 128 (for reasonable polygon geomtry). My implementation makes makes a few other optimizations:
1. only rendering convex silhouette edges and
2. using the depth offset to push the anti-aliased edges back behind the polygon they're on the edge of a bit (without it small stuff looks speared)
3. rendering specific (pre defined) edges in front of the rendered model to smooth high-contrast edges inside the model body.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Member
Posts: 145
Joined: 2002.06
Post: #7
While I look for some free time to clean up the code, here's a sample of the result:

(That was rendered on a GeForce2, but the output looks identical on a Rage128)

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Luminary
Posts: 5,143
Joined: 2002.04
Post: #8
Very impressive, particularly given that you need very much the same data for stencil shadows -- this might allow polygon antialiasing and stencil shadows simultaneously on today's hardware
Member
Posts: 145
Joined: 2002.06
Post: #9
Very impressive, particularly given that you need very much the same data for stencil shadows -- this might allow polygon antialiasing and stencil shadows simultaneously on today's hardware
That's a good point... Maybe I should reconsider this patent thing...

BTW, I haven't mentioned performance yet. With the model shown in that pic it's about a 30% raw polygon throughput performance hit on a Rage 128 IIRC. I can't find any of my old log files to verify that though. If someone has a rage 128 and would like to test it, you can get the demo app and a benchmarker here. (Note: where this really falls apart in terms of speed is on the GeForce2 and GeForce3. On these cards it takes about 75% cut in polygon throughput, because of hoops I have to make the graphics card jump through to render the way I want it to (3+ additional passes. some with blends against the destination alpha. ick).

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
Quote:Note: where this really falls apart in terms of speed is on the GeForce2 and GeForce3. On these cards it takes about 75% cut in polygon throughput, because of hoops I have to make the graphics card jump through to render the way I want it to (3+ additional passes. some with blends against the destination alpha. ick).

Given that that's something like 80% of the PC market, that's quite a big drawback... you might as well turn on FSAA in that case.

What do those cards do differently to the Rage128?
Member
Posts: 145
Joined: 2002.06
Post: #11
Given that that's something like 80% of the PC market, that's quite a big drawback... you might as well turn on FSAA in that case.

What do those cards do differently to the Rage128?
The GeForce2 and possibly GeForce3 (I'm getting mixed reports) doesn't support rendering lit, textured, smoothed lines. This means I have to use the alpha buffer to hold the mask of the lines, then go back and draw them as thick lines.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Moderator
Posts: 869
Joined: 2003.01
Post: #12
Quote:Originally posted by inio
The GeForce2 and possibly GeForce3 (I'm getting mixed reports) doesn't support rendering lit, textured, smoothed lines. This means I have to use the alpha buffer to hold the mask of the lines, then go back and draw them as thick lines.

Lines seem to render just fine for me, even smoothed and textured. I have a gf2mx.

- D.G
Member
Posts: 145
Joined: 2002.06
Post: #13
Quote:Originally posted by DoooG
Lines seem to render just fine for me, even smoothed and textured. I have a gf2mx.

- D.G
That's odd, maybe it was a bug in the OpenGL drivers I developed this with. I could get everything working except (2D) texturing and smoothing at the same time. This could be a significant improvement if it was a driver bug.

BTW, has anyone had a chance to run the benchmarker app in that .sit on a rage 128 yet? I'd be interested in the numbers.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Apprentice
Posts: 5
Joined: 2009.01
Post: #14
Quote:Originally posted by inio
BTW, has anyone had a chance to run the benchmarker app in that .sit on a rage 128 yet? I'd be interested in the numbers.

Nope but this is what I got on my tiBook.

GL_RENDERER: ATI Radeon 7500 OpenGL Engine
drew 5585.7k polys per second @ 30.0 fps (gl backface cull)
drew 1054.0k polys per second @ 30.0 fps (local backface cull + anti-alias)

.johan
Member
Posts: 145
Joined: 2002.06
Post: #15
Quote:Originally posted by JPersson
Nope but this is what I got on my tiBook.

GL_RENDERER: ATI Radeon 7500 OpenGL Engine
drew 5585.7k polys per second @ 30.0 fps (gl backface cull)
drew 1054.0k polys per second @ 30.0 fps (local backface cull + anti-alias)

.johan
That's weird, those numbers are almost identical to what I get on my GF2 with the multi-pass process, but the multi-pass stuff only activates on GeForce2s. I really need to look into this as soon as school calms down.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!