I've read numerous descriptions of the behavior of dFdX(n)
and dFdY(n)
and do believe I still have a handle on partial derivatives from school. What I don't follow is where does 'n' come from in the simplest possible example?
Reading the glsl built-in functions dFdx(n)
and dFdy(n)
without any context other than mathematics I would interpret them as "I have some function of x and y: f(x,y)
, I take the partial derivative of that function w.r.t. x d/dx(x,y)
, and I evaluate the partial derivative formula for some value of x
and y
which I assume is the input parameter n
above.
I've read many descriptions of how dFdx()
and dFdy()
allow you to find a window-space gradient for output fragments. The output-fragment case is what I'm most interested in at the moment as I'm not trying to determine the rate of change of texture coordinates w.r.t how the texture is being rasterized.
I'm looking to use dFdx(n)
and dFdy(n)
to find window-space color gradient of output fragments. I don't fully understand how to mentally construct the function being differentiated and how that relates to the frame buffer and how n
relates to that (e.g. does n
relate to the 2x2 fragment neighborhood of the current fragment, window coordinate space of the entire framebuffer such that I'm evaluating the gradient at that value, other) ?
I'm hoping that the input type of n
in any responses to this question is a scalar (float) and that we just discuss one dimension, dFdx()
, to simplify the discussion.