Jump to content
  • Advertisement
Sign in to follow this  

Artifacts

This topic is 4738 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am facing the following problem When i draw two diff triangles that share a line as separate primitives i.e. glBegin(GL_TRIANGLES ); . . . glEnd(); glBegin( GL_TRIANGLES ); . . . glEnd(); i see artifacts at the common line they share. Is there any way to avoid this ... I tot this would be some common problem ... no replies yet [Edited by - _gl_coder_one_ on June 1, 2005 2:51:36 AM]

Share this post


Link to post
Share on other sites
Advertisement
post a screenshot,

try
verts[] = (0,0,0),(1,0,0),(1,1,0),(3,54,6)
glBegin( GL_TRI );
glVertex3fv( verts[0] );
glVertex3fv( verts[1] );
glVertex3fv( verts[2] );
glleND();
glBegin( GL_TRI );
glVertex3fv( verts[1] );
glVertex3fv( verts[2] );
glVertex3fv( verts[3] );
glleND();

edge 1-2 shared
instead of
glBegin( GL_TRI );
glVertex3fv( (0,0,0) );
glVertex3fv( (1,0,0) );
...
...

Share this post


Link to post
Share on other sites
Quote:
Original post by vNistelrooy
Are you using a 32-bit depth buffer?


i am using QGLWidget that is provided by Qt . And in Linux i hav found no method request
a depth buffer of given precision ... any idea on how to get the 32 bit depth buffer ?
I did read a bit abt the problem about artifacts .. .its called z-fighting and can be best solved using 32-bit depth buffer .. also i am working on a PC that has an on board graphics card ,,, do these actually have a 32bit depth buffer?

Share this post


Link to post
Share on other sites
Quote:
Original post by _gl_coder_one_
Quote:
Original post by vNistelrooy
Are you using a 32-bit depth buffer?


i am using QGLWidget that is provided by Qt . And in Linux i hav found no method request
a depth buffer of given precision ... any idea on how to get the 32 bit depth buffer ?
I did read a bit abt the problem about artifacts .. .its called z-fighting and can be best solved using 32-bit depth buffer .. also i am working on a PC that has an on board graphics card ,,, do these actually have a 32bit depth buffer?


I have no idea how to use the QGLWidget thing. This is called z-fighting. Find a way to set the depth-buffer to 32-bit.
The graphics card should be a problem.

Share this post


Link to post
Share on other sites
As I udnerstand it, it is a problem with a shared edge and some missing pixels on the edge, so Z-buffer precision should not be the problem.

If it is, you have to watch out for shared edges. The specification guarantees that two triangles sharing an edge covers all pixels exactly once only if they share the edge in the opposite directions. In zedzeeks example, the edge 1-2 is shared, but both triangles share it in the same direction; from vertex 1 to vertex 2. OpenGL does not guarantee exact pixel coverage in that situation. However, in his example, the two triangles have different winding order aswell, and mixing winding order is not something you should do anyway.

Concider a quad with vertices like this.

v3----v2
| |
| |
v0----v1

If you draw this quad as two triangles (v0, v1, v2) and (v0, v2, v3), the edge v0-v2 is shared in different directions. If you draw it as (v0, v1, v2) and (v0, v3 v2), it is shared in the same direction, but now the two triangles are also winded in different direction; one is clockwise, the other counter clockwise. In the first example, OpenGL guarantees that all pixels are covered exactly once. In the second, there are no such guarantees which may leave small gaps, or causing a pixel to be rendered twice, causing a mess if blending, for example, is enabled.

So you should always make sure triangles are winded in the same order, either clockwise or counter clockwise but not both, and problems like this will not occur.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!