PDA

View Full Version : polygon rasterization + simple antialiasing



rockeye
07-11-2006, 03:02 AM
Hi!

Try this :
- draw a simple filled triangle in a small viewport (32x32) into a FBO of the same size with smooth-polygon activated.
- draw the same triangle in a larger window (900x900)
- display the FBO color texture on a full screen quad

This is what I obtained :
Rasterization bug (http://alfflife.free.fr/images/rasterBug.jpg)
I have circled some artefacts.
The red area shows the antialiased-off-screen-rendered-triangle-cover with saturated alpha channel.
The white part is the same triangle in full screen.

In opengl2.0 spec, it's clearly written :" Polygon antialiasing rasterizes a polygon by producing a fragment wherever the interior of the polygon intersects that fragment’s square."

I must precised that the test above works perfectly with points and lines. The rules described in the spec are correctly followed.

I use no polygonOffset, culling or whatever...

GLX info :
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 7800 GT/PCI/SSE2
OpenGL version string: 2.0.2 NVIDIA 87.62

Actually, I don't want to solve this problem (although it would be better...), but is it a well known bug or is it come from a particular implementation ???

Relic
07-11-2006, 03:20 AM
No bug, you misunderstood the way a rasterizer works.
Read the whole OpenGL spec 2.0 Chapter 3 about rasterization.
You need to understand what "intersects" means in the sentence you cited.
It does not mean "touches a fragment somewhere", it must contain a discrete implementation dependent sample point to generate a fragment.

rockeye
07-11-2006, 03:33 AM
Originally posted by Relic:

Read the whole OpenGL spec 2.0 Chapter 3 about rasterization.
I did ! but I will perhaps read it again :(

What surprised me is the fact that points and lines rasterization with antialiasing is conservative. So I expected the antialiased polygon rasterization to be conservative too...

Relic
07-11-2006, 04:16 AM
Points and lines have different rasterization rules than polygons.
Antialiased polygon rendering is mostly useless anyway.

rockeye
07-11-2006, 04:42 AM
That's not the point. I didn't try that to achieve a graphical result.
I must detect every pixel intersected by a polygon to perform additionnal data processing.

The algorithms for conservative rasterization are often too heavy (I try those of GPU Gem2) and I need a quickest way to obtain a similar result.

When I saw that antialiased lines rasterization was conservative, I hoped that the polygonal one was too. But apparently, it isn't !

I think a possible way to carry out my application is to render a simple polygon to detect all pixels inside, and draw the polygon boundaries in wireframe to catch all pixels left.

If someone has an other possible method, it would be great !