0

weird artifacts

I'm doing opengl tessellation and this is the drawing I get. If I cull the back face, those darker spots tend to disappear. This looks like Z-fighting, but I don't know where this issue should be adressed (I've tried unsuccessfully to increase the model size)

Adriano
  • 389
  • 3
  • 11
  • 1
    What are your projection matrix parameters? – Tim Dec 01 '12 at 00:26
  • void Camera::RecalculateProjection() const { projection = Perspective(fovY, aspectRatio, nearPlane, farPlane); } projection is a mat4 – Adriano Dec 01 '12 at 00:35
  • 1
    How are you doing "some tessellation"? Are you talking about gluTess stuff, or actual [OpenGL 4.0-style tessellation?](http://www.opengl.org/wiki/Tessellation) – Nicol Bolas Dec 01 '12 at 00:36
  • I mean what is your near/far values compared to the size of your object. You get z-fighting when your near/far are too many orders of magnitude apart. Try pushing out the near plane and pulling in the far plane as much as possible. – Tim Dec 01 '12 at 00:37
  • Oh, the near plane is 0.1 and the far is 1000.0 The object has radius 1 – Adriano Dec 01 '12 at 00:37
  • @Adriano: You didn't answer my question. – Nicol Bolas Dec 01 '12 at 03:04
  • Oh sorry, openGL tessellation. model and view transformations are done in the vertex shader, projection is done in the tessellation evaluation. If I move everyone to TE, no z-fighting but the model becomes round. If I move everyone to vertex shader, keeps looking like this and moving the camera closer distorts the object into a ball and then it goes backwards – Adriano Dec 01 '12 at 08:04
  • I'm sure the camera clas, which generate projection and view matrices are fine, and the model matrix is fine as well – Adriano Dec 01 '12 at 08:10
  • Posting your TC and TE shaders would certainly help. That said, are you setting the tessellation levels in the TC? That might explain why the objects appears "round". Further, moving all of your transformations into the TE isn't uncommon. – radical7 Jan 21 '13 at 17:16

1 Answers1

0

The near plane should be as far as possible, and the far plane as close as possible. In your case 1000 is way to much.

Increasing the near plane helps more, but in your case it looks like the model already is quite close.

Calvin1602
  • 9,413
  • 2
  • 44
  • 55