opengl如何决定要使用的Mip级别? [英] How does opengl decide which mip level to use?

查看:100
本文介绍了opengl如何决定要使用的Mip级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题很容易解释.我问的是使用可能来自任何地方的纹理坐标(均匀,变化,另一个纹理获取).

The question is fairly self explanatory. I'm asking in terms of using texture coordinates that could have come from anywhere (a uniform, a varying, another texture fetch).

例如,我对一个mipmapped(或各向异性过滤)的纹理进行纹理获取,并使用在顶点着色器中设置的变化的平方.我假设glsl无法确定像这样的任意复杂函数的导数,那么它怎么知道要使用哪个mip级别?

Say for example I do a texture fetch on a mipmapped (or anisotropically filtered) texture, and I use the square of a varying which was set in the vertex shader. I assume that glsl cannot determine the derivative of an arbitrarily complex function like this, so how does it know which mip level to use?

谢谢.

推荐答案

通常使用空间连贯性.它在至少2x2像素的块上计算相同的值,并计算相邻像素之间的离散差.对于导数而言,这就足够了.

It is usually using spatial coherence. It computes the same value on a block of at least 2x2 pixels, and computes the discrete difference between the neighbors. That's enough of an approximation for the derivative.

这篇关于opengl如何决定要使用的Mip级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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