大型几何体GL_REPEAT上的OpenGL ES 2.0纹理扭曲 [英] OpenGL ES 2.0 texture distortion on large geometry GL_REPEAT

查看:476
本文介绍了大型几何体GL_REPEAT上的OpenGL ES 2.0纹理扭曲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenGL ES 2.0在纹理采样方面存在严重的精度问题 -
我见过的主题是
但我还没有看到这个扭曲的OpenGL ES 2.0纹理问题的真正解决方案。

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.

这与纹理的图像格式或OpenGL颜色缓冲区无关,似乎是精度错误。我不知道是什么原因导致精度失败 - 它似乎不仅仅是导致这种失真的几何尺寸,因为简单地缩放传递给顶点着色器的顶点位置并不能解决问题。

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:

纹理通常是什么样的(也在OpenGL ES 2.0上): http://i49.tinypic.com/b4jc6c.png

What the texture normally looks like (also on OpenGL ES 2.0): http://i49.tinypic.com/b4jc6c.png

纹理问题仅限于OpenGL ES 2.0上的小规模几何体,否则纹理采样看起来正常,但颗粒效果会逐渐恶化顶点数据离XYZ的原点越远( 0,0,0)

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)

这些纹理问题没有在桌面OpenGL上发生(在Windows XP,Windows 7和Mac OS X下正常工作)

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

我只看到Android,iPhone或WebGL上出现此问题(这类似于OpenGL ES 2.0)

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

所有纹理都是2的强弱但是问题仍然会发生


  • 缩放顶点数据 - 顶点XYZ位置的值在范围内:
    -65536到+65536浮点

  • Scaling the vertex data - The values of a vertex's X Y Z location are in the range of: -65536 to +65536 floating point


  • 我意识到这很大,所以我尝试将顶点位置除以1024缩小几何体并希望获得更准确的浮点精度,但这不能解决或减少纹理失真问题

缩放模型视图或缩放投影矩阵无效

更改纹理过滤选项不会帮助


  • 禁用mipmapping或使用GL_NEARE ST / GL_LINEAR不执行任何操作

  • 启用/禁用各向异性不执行任何操作

  • 即使使用GL_CLAMP

  • ,仍然会出现绑定效果
  • Disabling mipmapping, or using GL_NEAREST/GL_LINEAR does nothing
  • Enabling/disabling anisotropic does nothing
  • The banding effect still occurs even when using GL_CLAMP

将传递给顶点着色器的纹理坐标划分,然后将它们再次传递回片段着色器中的正确值,也可以不工作

Dividing the texture coords passed to the vertex shader and then multiplying them back to the correct values in the fragment shader, also does not work

precision highp sampler2D,highp float,highp int - 在片段或顶点着色器中没有改变任何东西( lowp / mediump也不起作用)

precision highp sampler2D, highp float, highp int - in the fragment or the vertex shader didn't change anything (lowp/mediump did not work either)

我认为这个问题必须在某个时刻得到解决 - 看到基于OpenGL ES 2.0的游戏已经能够呈现大规模,高度详细的几何体

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

推荐答案

这是通常的纹理地图集问题。没有设置来限制纹理中间的线性插值。这就是硬件的工作原理。

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.

这篇关于大型几何体GL_REPEAT上的OpenGL ES 2.0纹理扭曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆