nasty colors with GL_SMOOTH
Hi.
I get strange pieces of nasty colors when I use GL_SMOOTH. They dissapear with GL_FLAT. Please, take a look to this image: http://www.aule3d.com/album/img.jpg
Can anybody help me?
Thanks a lot.
Hi, V-man
There's a hope to the world with people that gets interested in others's problems. Thank you for that.
Symptoms:
1. Nasty Triangles become smaller and in less quantity when rendering at a bigger size.
2. They are very often in terrain areas paralell to view line, for example, in the top of the mountains.
3. It doesn't depend on the presence of a texture (they appear with both glEnable(GL_TEXTURE) and glDisable(GL_TEXTURE). And in any conditions of light and color.
3. They often dissappear when hiding (not rendering) terrain beyond and near to the area where they before appeared.
4. Closer areas to the view point never have nasty triangles.
For me, it's something related to the z-buffer. This is the related code:
glFrontFace(GL_CCW);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
And
glClearColor(backColor.R, backColor.G, backColor.B, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
And
glShadeModel(GL_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
And
gluPerspective(aperturaV, wRenderA / hRenderA, max(dMin, 10), dMax);
where dMin and dMax are the minimum and maximum distances from the observer.
A very important symptom is that more (much more) bad triangles appear when dMax is big.
You have a new image in the same link, showing triangles closer.
Thank you for your interest
There's a hope to the world with people that gets interested in others's problems. Thank you for that.
Symptoms:
1. Nasty Triangles become smaller and in less quantity when rendering at a bigger size.
2. They are very often in terrain areas paralell to view line, for example, in the top of the mountains.
3. It doesn't depend on the presence of a texture (they appear with both glEnable(GL_TEXTURE) and glDisable(GL_TEXTURE). And in any conditions of light and color.
3. They often dissappear when hiding (not rendering) terrain beyond and near to the area where they before appeared.
4. Closer areas to the view point never have nasty triangles.
For me, it's something related to the z-buffer. This is the related code:
glFrontFace(GL_CCW);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
And
glClearColor(backColor.R, backColor.G, backColor.B, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
And
glShadeModel(GL_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
And
gluPerspective(aperturaV, wRenderA / hRenderA, max(dMin, 10), dMax);
where dMin and dMax are the minimum and maximum distances from the observer.
A very important symptom is that more (much more) bad triangles appear when dMax is big.
You have a new image in the same link, showing triangles closer.
Thank you for your interest
Quote:Original post by jcurru
For me, it's something related to the z-buffer. This is the related code:
...
glDepthFunc(GL_LESS);
...
A very important symptom is that more (much more) bad triangles appear when dMax is big.
You might try glDepthFunc(GL_LEQUAL); instead?
I agree it sure looks like a z-buffer issue. Almost as if it isn't being cleared!
Perhaps try some manual values, like 1.0 and 10000.0 as a really close nearClip will effect the float accuracy a lot.
Perhaps try some manual values, like 1.0 and 10000.0 as a really close nearClip will effect the float accuracy a lot.
Looks more like something has gotten corrupted rather than a depth precision issue. Try to find out which triangle has the problem and render only those ones.
But the first thing I would do is run the program on another system with another video card.
But the first thing I would do is run the program on another system with another video card.
Hello again, V-man and jezham.
The image becomes PERFECT (but different) disabling GL_SMOOTH. So, I think it is not related with clearing the z-buffer. And I have tested tmy program with several videro cards, and never works. So It IS a software (solvable) problem. In the other hand, those little nasty triangles do not match the shape of the triangles rendered in that areas. So it is not a geometry problem.
The float accuracy could be the problem. But it would really ashtonish me, because having the near plane at 4000 and the far plane at 8000, that wouldn't happen in OpenGL. And the problem only appears when GL_SMOOTH is on!. What is the relation between the z-buffer and smoothing?
Have you ever seen something like this?
Thanks for your support.
The image becomes PERFECT (but different) disabling GL_SMOOTH. So, I think it is not related with clearing the z-buffer. And I have tested tmy program with several videro cards, and never works. So It IS a software (solvable) problem. In the other hand, those little nasty triangles do not match the shape of the triangles rendered in that areas. So it is not a geometry problem.
The float accuracy could be the problem. But it would really ashtonish me, because having the near plane at 4000 and the far plane at 8000, that wouldn't happen in OpenGL. And the problem only appears when GL_SMOOTH is on!. What is the relation between the z-buffer and smoothing?
Have you ever seen something like this?
Thanks for your support.
Just a guess, but try disabling GL_POLYGON_SMOOTH. You will probably never need this and it will not give the desired resulst anyway. You would normally use Multisampling for AA.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement