Terrain flickering

Started by
9 comments, last by CProgrammer 19 years, 7 months ago
How do I get rid of the flickering on my terrain engine when it is viewed from a distance. I heard it was Geomipmapping that I need. If so, could someone explain this to me. This project uses OpenGL. -CProgrammer
Advertisement
You need to be more specific about your problem. I'm guessing that the 'flickering' is due to z-fighting, Geomipmapping (or LOD in general) shouldn't have anything to do with fixing this flickering effect. Make sure your z-buffer is set to 24 bits or higher, and set your near clip plane to >= 1 if it isn't already.
The problem is basically that when I have one texture per tile on the terrain, viewed from a distance it will look very much like 'noise'; flickering. If I span one texture over the entire terrain its much better.
Ill have a look at my Z-Buffer options maybe that will help.
But I still think its something else, perhaps too large textures or 'MipMapping'(not too familiar with that either).

Oh and this is just verts, textures, and vert colors.
No materials or lighting could that be the culprit.

-CProgrammer
To me, it sounds like you have not tried mipmapping the textures. From what you describe, I think that it would solve your problem.
Thanks, Ill try that.

-CProgrammer
One question though.
Is it bad practice to just have all your textures as mipmaps?
Hmm didnt seem to help.
Perhaps I implemented mipmapping wrong?
I switch my glTexImage2D calls with gluBuild2DMipmaps.

-CProgrammer
In my engine, the default is to mipmap the texture. In some cases it may be better not to have it (ie: I disable mipmapping for my fonts).

Mipmapping is usually a good thing. It greatly aids visual quality when a texture is viewed at a distance - since mipmapping produces lower resolution versions and the gpu picks the one that would best fit the current needs.

About the "didn't seem to help":

Did you specify: magfilter=minfilter=GL_LINEAR_MIPMAP_LINEAR; for the glTexParameter?

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,magfilter);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,minfilter);
Ah there we have it.
Looks great, exactly what Im looking for. Thanks.

-CProgrammer
There are faster options than gluBuild2DMipmaps.

Check out this link

This doc is a bit old. Check out GL_GENERATE_MIPMAP as an alternative to GL_GENERATE_MIPMAP_SGIS. It's in the OpenGL specs. I have used both gluBuild2DMipmaps and GL_GENERATE_MIPMAP. I believe automatic mipmap generation was promoted to the core in OpenGL version 1.4

This topic is closed to new replies.

Advertisement