View Full Version : Strange rendering artifacts...
04-16-2005, 12:21 PM
Hello, I'm currently developing my own engine based on OpenGL as rendering api, everythings going fine, but today testing, I created a glu sphere and it looked like this after enabling lighting:
As Im pretty new to OpenGL, maybe this is a common or known problem but as said, I havent got nailed all the opengl problems I could get yet.
I can think of one thing.. normals, although seems like a z-ordening problem or something related to this.
04-16-2005, 12:29 PM
Looks like the z-buffer is the problem.. for what I could test (Im a directx guy, and thought this could be the problem.. as I had before with dx7).
so I assume the z-buffer is in 16bits mode..
How do you change the z-buffer to 32bits??
04-16-2005, 01:34 PM
i'm not sure that it will help you but have put glEnable( GL_DEPTH_TEST );
04-16-2005, 02:25 PM
Hi, thanks for the tip but its a z-buffer problem.. not a z-ordening problem as I stated (bah, I said it might possibly be).
I'm using 0.5, 1000.0 for the GLU perspective, works ok so far. But now im getting trouble with the FOG.. its not working. weird.
04-16-2005, 02:28 PM
about the fog, looks like my scales were very very small, i'll scale up everything. or use GL_FOG_START and END to fix the "scales"... although im testing with just a sphere on screen, not a good idea!.. i'll make a flipped cube to test the fog.. that sounds better.
04-17-2005, 08:36 PM
Yup looks like a zbuffer issue.
I'd say the inside was zfighting with the outside. This means you have totally attrocious depth buffer precision.
Of course, if that IS the case, you could just cull backfaces.
04-18-2005, 04:29 AM
Hi people, notice I was already culling backfaces so that might not be the case?, but I fixed it with a bigger value for zNear !
This is what im using now
zNear = 0.5
zFar = 1000.0
Hmm, I suppose there's a typo in your last post, as these are the same values as before. Anyway, I think I remember a post here a few years ago that said that it's not a good idea to have a big difference between zNear and zFar. Maybe it would be better to have them like 50-1000 or something. It probably has to do with perspective division and (you guessed it!) z-buffer precision. Also don't forget, that once you start increasing your zNear you might want to double check where you draw your sphere. Once, the near plane clipped my sphere and I was seeing the inside, so be careful. Cheers
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.