PDA

View Full Version : Surface display screwed up during zooming



cloudthegreat
02-25-2005, 02:31 PM
Hi, I have a strange problem regarding surface displaying under lighting. I draw a foot surface, and add lighting. Suppose I am looking at the back side of the foot. Initially it looks fine. However, when I start zooming by moving my camera(using gluLookAt()) closer or farther from the original camera position, the foot's back surface starts looking funcky. Sometimes I can see the front side of the foot surface although I am stricly looking at the back of the foot. In general, the surface looks fine in some camera positions and looks funky in other camera positions. One major problem is that I often see the opposite surface I have very little clue what could have gone wrong here. Can some experienced programmers point out possible causes?

Mikkel Gjoel
02-25-2005, 02:45 PM
Sounds like your near-plane is intersecting with the geometry? Not really an advanced topic, but try setting your near-plane to something closer (like 0.001f)

cloudthegreat
02-25-2005, 05:15 PM
I have tried that but the problem still persists. I just found that the surface display would become funky during rotation as well. At some rotation angle, the surface looks fine, but at another angle, the "backside" surface would become the frontside surface.

yooyo
02-26-2005, 12:29 AM
I suppose you are using gluPerspective call... Could you post piece of your code with this call?

yooyo

Mikkel Gjoel
02-26-2005, 03:59 AM
Have you made sure to enable depth-test, back-face culling (with the same winding-orientation that you use to specify your triangle - typically counterclockwise).

:) - also, a screenshot might be a good idea, "funky" just might not be descriptive enough :)

\\hornet

cloudthegreat
02-26-2005, 02:20 PM
I am doing a marching cube data visulization project. Since the triangles of my surface do not always have the front face facing outside, I hope to avoid the curlling function. I do have the depth test enabled.

Here is two screen shots.

fine image, looking from behind the feet (http://128.195.174.183/pic1.jpg)
funky image, still looking from behind the feet, but you can see the front of the toes appearing (http://128.195.174.183/pic2.jpg)

As of lastest, I found that if I zoom in very close to the surface, and rotate it, there seems to be no problem. The problem arises when I am zooming away from the surface. Then it seems the depth testing fails, i.e. the "back surface" keeps popping to the front, like pic2 shows.

richardv
02-26-2005, 05:13 PM
To get more depth buffer precision:

* Use a larger near plane distance (important)
* Use a smaller far plane distance
* Use a higher precision format like 24 bit instead of 16 bit

- Richard