通过opengl函数调用调整opengl纹理lod偏差?
如何通过 opengl 函数调用来改变 lod 偏差?我不喜欢默认设置,太早更改 miplevel 并使附近的地面看起来很丑。
我找不到任何代码来做到这一点,每个主题都是关于一些完成这项工作的外部程序...
编辑:这是我的纹理设置:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
how is it possible to change the lod bias via an opengl function call? i dont like the default settings, changes the miplevels too early and makes the nearby ground look ugly.
i couldnt find any codes to do this, every topic was about some external programs that does the job...
Edit: This is my texture settings:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用:
更多详细信息请参见:
http://www.opengl.org/sdk/docs/man/xhtml /glTexEnv.xml
那里: http://oss.sgi.com/projects/ ogl-sample/registry/EXT/texture_lod_bias.txt
编辑:
好的,我明白了。首先
GL_TEXTURE_MAG_FILTER
只能采用两个可能的值:GL_NEAREST
GL_LINEAR
因此,使用
GL_LINEAR
可以获得最佳结果。然后对于
GL_TEXTURE_MIN_FILTER
,使用GL_NEAREST_MIPMAP_NEAREST
,您不使用纹理插值,仅使用mipmap(您采用最适合的最近的mipmap,但在此mipmap中您仅采用最近的纹理元素,没有在这个纹理像素和他的邻居之间进行插值)。因此,请使用 GL_NEAREST_MIPMAP_LINEAR 来执行纹理像素之间的加权平均。
使用 GL_LINEAR_MIPMAP_LINEAR ,您可以获得更高的渲染质量,因为它将在两个 mipmap(mipmap N 和 N+1)的纹理获取结果之间使用线性插值,而不是仅获取纹理结果与之前一样,获取 mipmap N。
GL_LINEAR_MIPMAP_LINEAR
也称为三线性过滤。Use:
More details here:
http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml
and there: http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_lod_bias.txt
EDIT:
Ok, I see. First
GL_TEXTURE_MAG_FILTER
can only take two possible values:GL_NEAREST
GL_LINEAR
So use
GL_LINEAR
for the best result.Then for
GL_TEXTURE_MIN_FILTER
, withGL_NEAREST_MIPMAP_NEAREST
you are using no texture interpolation, only mipmaping (you take the nearest mipmap that suits the best, but inside this mipmap you take the nearest texel only, without interpolation between this texel and his neighbours).So use
GL_NEAREST_MIPMAP_LINEAR
for doing this weighted average between the texels.With
GL_LINEAR_MIPMAP_LINEAR
you can have even more rendering quality since it will use a linear interpolation between the result of the texture fetch for two mipmaps (mipmap N and N+1) instead of just taking the result of the texture fetch for mipmap N, like previously.GL_LINEAR_MIPMAP_LINEAR
is also known as trilinear filtering.