Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top