Hi all
I have an extremely simple scene.
Just a 50 scale plane with a 100,100 tiled texture on it.
No matter what settings I use, I cant get it to render the top third without weird distortion.
Its for android.
Is it at all possible to have a tiled texted plane that goes to the horizon that doesn’t distort on phones?
Thanks for any info
That’s a lack of UV precision. According to the OpenGL ES spec, Android devices only need to have so much precision for UV coordinates in the fragment shader. I think it was 16-bits, but I’d have to look it up again to be sure. UV coordinates normally go from 0 to 1 so this is usually fine. If you start tiling textures a lot (common with something like a static terrain mesh), you will start getting distortion because the lack of precision will cause lots of huge rounding errors in your texture samples.
You might need to add some more tessellation to your geometry, and the vertex shader needs to be performing a modulo operation on the coordinates to keep the UV values from getting too high.
If what I wrote doesn’t make any sense to you, an alternative that is just as good (or better) is to create your plane procedurally and perform the modulus operation on the UVs when you generate them. There should be some good examples you can find of generating procedural planes, and you just want to create them such that your UVs are never much greater than 1 (i.e. take the modulus of your world space (X,Y) coordinates). That should also solve the problem.
If you’re familiar with any 3D modeling software, you could also create your plane there–making sure to map all quads’ UVs to a reasonable range–and then import it into Unity.