Weird rendering behaviour

Please check out this link http://home.cogeco.ca/~nteeuwen/Problem/Problem.htm I needed images to explain the problem.

thats Z-fight problem. If that becomes worse during render you probably change the zNear and zFar in some way.

Yup, that’s z-fighting.

This page explains it very well:

http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html

I suspected as much. The only problem I have is that I am using an orthographic view, not a perspective view. I read the article and it seems to relate to perspective. With orthographic I would think that the precision of Z would be linear.

Originally posted by NTBone:
I suspected as much. The only problem I have is that I am using an orthographic view, not a perspective view. I read the article and it seems to relate to perspective. With orthographic I would think that the precision of Z would be linear.
You can see z-fighting in orthographic if you don’t setup your z-range properly: if your geometry has z-coordinates ranging from 1.5 to 2, but you set the depth range to cover values from 0.1 to 1000000, then you are going to have depth fighting, no matter the view is orthographic or not.

The thing that puzzles me is that:

  1. At first you don’t have z-fighting.
  2. You zoom in, you see the z-fighting problem.
  3. You zoom out, and you still see it.

The only thing I can think about is that you are accumulating matrix multiplies on your projection or modelview matrix, in such a way that you are losing precision. How do you zoom in/out? Do you reset your matrix every frame or are you accumulating over the previous frame’s matrix?

I did figure out what was causing hte weirdness when zooming out. The code loses precision because delta operations are applied. So orthographic is linear? It seems to be. There should be no perspective divide by 1/z so the z precision should be the same no matter how far away the object is.

If model view is identity and we have a simple ortho set up then the z value of the object is simply scaled to lie between 0 and 1 (based on near and far) and that is the z value put in the buffer.

Hmmm… I dunno what’s happened here I thought I’d posted to this thread, now my posts and several others are gone. I can’t find a duplicate thread so what the heck is going on? Am I missing another thread, is this database corruption or did this degenerate into a flamewar while I wasn’t looking?

Originally posted by dorbie:
Hmmm… I dunno what’s happened here I thought I’d posted to this thread, now my posts and several others are gone. I can’t find a duplicate thread so what the heck is going on? Am I missing another thread, is this database corruption or did this degenerate into a flamewar while I wasn’t looking?
One of those dodgy moderators probably deleted it. :smiley:

Sorry, no conspiracy here. Sounds like corruption. Explains why I can search for my name as a keyword in this forum and get six hits while a search by registered member number reveals only one. Mind you the post I made long ago (which I was looking for) was not one of the six.

Originally posted by JotDot:
Sorry, no conspiracy here. Sounds like corruption. Explains why I can search for my name as a keyword in this forum and get six hits while a search by registered member number reveals only one. Mind you the post I made long ago (which I was looking for) was not one of the six.
It seems that posts have only been indexed against the member number since we had the server trouble.

Mystery solved, I got these threads mixed up:

http://www.opengl.org/discussion_boards/…t=016004#000013