PDA

View Full Version : Very small triangle



devdept
11-13-2009, 02:36 PM
Hi All,

In our app we can't display a triangle with vertex coords like:

0,0 | 1e-6,0 | 0,1e-6

If we draw lines between these three vertices we can see them but not polygons.

If we change the coords as:

0,0 | 1e-5,0 | 0,1e-5

The triangle is visible.

We double checked near and far planes settings and everything seems ok. What else should we check?

Thanks,

Alberto

ZbuffeR
11-13-2009, 03:15 PM
What is the surface in pixels of such a triangle ? If less than 0.5 pixels², then it is normal that the triangle produces no fragment. Try with utra high MSAA (16x), to see if it is better.

skynet
11-13-2009, 03:33 PM
If less than 0.5 pixels², then it is normal that the triangle produces no fragment.

Not quite true. The triangle can "cover" a pixel, even if it is smaller that a pixel or half a pixel. What matters is, if the pixel center lies within the triangle or not. So for a very small triangle, it may or may not leave a pixel, depending on its position on the screen - which could be what the OP is observing.

Edit:
I forgot! Also be aware that line rasterization is completely different from triangle rasterization. That explains why you can see the lines, but not the triangles.

ScottManDeath
11-13-2009, 05:38 PM
Conservative rasterization generates fragments if the triangle intersects any fraction of a pixel, and not just its center.

http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter42.html

devdept
11-14-2009, 07:44 AM
I'm sure that it works because on the same machine the same triangle can be drawn with a earlier version of our program. We compared all the OpenGL source code and didn't find anything relevant.

I was asking a clue to inspect in more depth.


Thanks,

Alberto

devdept
11-15-2009, 01:54 PM
Considering we have two versions of the same program, one that can render the small triangle and the other that cannot. If we sniff GL calls we should discover where the difference are, right?

Can you please provide us a link to download one of them? I remeber something glDevil, but it isn't the exact name.

Thanks,

Alberto

yooyo
11-15-2009, 02:50 PM
glIntercept

devdept
11-16-2009, 06:49 AM
Oh, yes. That's was the name. Already downloading it...

Thanks,

Alberto