So I read the OpenGL info page on textureGrad
but it doesn't really explain anything.
So you can explicitly specify the partial derivatives of P relative to X and Y
My mind has been blown.
When you invoke a texture sample operation on the GPU, the GPU does the following:
Now, suppose you have different neighboring fragments that branch (say due to some material or something) such that on invocation of that shader, sample requests to different textures are made at the same time. You run into a problem if the tiling rates for these textures are different which will break the MIP selection (the incoherence of this undefined operation will result in a noisy render). The solution is to query for the gradients yourself using dFdx and dFdy outside of the branch and use the textureGrad
function within the branch, applying the correct tiling multipliers to your gradients.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With