I'm trying to make a mesh look in a particular way and it all works great, except for one face that renders as in the attached screenshot. This happens as soon as I set the Material's texture to 0.5. Must be something obvious but I just can't see why... How can I fix it?
This example works without artifacts you shown on my GPU. BTW do you really want to use TexCoords Generated? I had some problems with it on different HW, also I'm not sure it works on Android...
That's not being caused by Z-fighting. The reason why it causes glitches ( on some GPUs ) is because with those settings ( nearest neighbor filtering + resulting texture matrix ) the texture coordinates for the bottom vertices of the large cube are exactly at 0.125 ( exactly between the 8th and 9th pixel-row from the bottom ), which when looked at from a angle causes some fragments to be sampled from row 8 and others from 9.
Either offset the texture matrix ( MaterialTexture.TextureY ) by a very small number ( 0.00001 or something ), or change row 8 of the bitmap so it matches row 9 .. or do this
Rado1: Right, I should avoid using that (I was advised against using it in the chat too). It's just that in this particular case using this option made it almost work and I tend to leave the settings I'm not familiar with on default... One wonders why is TexCoords Generated the default option if it's causing problems
Kjell: Offsetting the texture sounds like the cheapest "solution" for this particular problem since I don't have that much influence over the details of the texture (other than feeding the BitmapCells a new seed). Fixing normals is maybe a bit too detailed for this situation (thanks for showing me how to do it, maybe I'll need it in the future)...
I'll also change the title of the thread to something that doesn't include "z-fighting" (I named it this because the effect looked similar but turns out it's unrelated).
The OpenGL feature that "TexCoords = Generated" relies on is simply not available in OpenGL ES ( nor modern OpenGL ), and ZGE doesn't have a software fallback implemented ( for ES 1.1 ). But the primary reason you should avoid it is that it generates / calculates the texture coordinates each frame, which is a waste of cycles when you're not using it for a specific effect ( chrome / ghost / lava etc. ).
And something like "texture glitch" would have been a more suitable title ( to prevent confusion between fragmented and fragments .. which are completely unrelated )