问题
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).
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?
Thanks.
回答1:
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.
来源:https://stackoverflow.com/questions/1523488/how-does-opengl-decide-which-mip-level-to-use