user1507596
user1507596

Reputation: 69

OpenGL ES 2.0 texture distortion on large geometry GL_REPEAT

OpenGL ES 2.0 has serious precision issues with texture sampling - I've seen topics with a similar problem, but I haven't seen a real solution to this "distorted OpenGL ES 2.0 texture" problem yet.

This is not related to the texture's image format or OpenGL color buffers, it seems like it's a precision error. I don't know what specifically causes the precision to fail - it doesn't seem like it's just the size of geometry that causes this distortion, because simply scaling vertex position passed to the the vertex shader does not solve the issue.


Here are some examples of the texture distortion:

The texture issue is limited to small scale geometry on OpenGL ES 2.0, otherwise the texture sampling appears normal, but the grainy effect gradually worsens the further the vertex data is from the origin of XYZ(0,0,0)

These texture issues do not occur on desktop OpenGL (works fine under Windows XP, Windows 7, and Mac OS X)

I've only seen the problem occur on Android, iPhone, or WebGL(which is similar to OpenGL ES 2.0)


All textures are power of 2 but the problem still occurs

I'm thinking this problem has to have been solved at one point - Seeing that OpenGL ES 2.0 -based games have been able to render large-scale, highly detailed geometry

Upvotes: 6

Views: 1852

Answers (1)

user1465380
user1465380

Reputation:

This is the usual texture atlas problem. There is no setting to limit the linear interpolation in mid-texture. That's how the hardware works.

You can work around the issue by using nearest filter texture lookup in a fragment program which calculates the texture lookup modulo your texture tile size and position and does its linear filtering manually.

Upvotes: 1

Related Questions