Like in topic. I am making voxel engine based on 16X256X16 tile arrays and encountered strange problem. Screenshots below:
Rendering close to camera is very good, but while looking from a distance artifacts begin to appear. This artifacts are mostly composed of curved lines and rarely straight lines, but when I am moving camera away from the center in straight line something interesting happens:
I don’t know what is causing this problem. I already tried using mipmaps and anisotropic filtering, but nothing works (I am not even sure if this is texturing issue or something else). Does anyone have idea why this happens and how can I fix this?
This is an image moire pattern. It cannot be eliminated only reduced using mipmaps and filtering.
Yep it’s a filtering problem.
You need to understand what you do when you’re rendering a ‘pixel’ with your voxel engine.
In a few words, you need to consider a pixel like a mini frustum from the near plane of your camera and your world (voxel world).
So when you render a pixel, you need to considerer the volumic shape of this pixel, and compute the “average” of the volume intersection (with your voxel grid).
With this kind of consideration, you’re transform your current (in your voxel engine, right now) pixel “point-sample” to a “area-sample” (frustum -> quad, (truncated) cone -> elipsoid, …).
Good luck ^^
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);