Difference between dFdxFine and dFdxCoarse

From the OpenGL documentation:

dFdxFine and dFdyFine compute derivatives using a local difference based on the p value for the current fragment and its nearest neighbor (s).

dFdxCoarse and dFdyCoarse compute derivatives using a local difference based on the p value for the current neighbors of the fragments and, possibly, but not necessarily, include the value for the current fragment. That is, in this area, an implementation can compute derivatives in fewer unique places than is allowed for the corresponding dFdxFine and dFdyFine functions.

What is the difference between the two? When do I care?

I understand that both calculate the derivative of the value related to the coordinates of the window, but I do not understand the method used to calculate them.

I assume that both of them are implemented in hardware, but could you post the implementation of the dFdx pseudo-code?

+4
source share
1 answer

From the GLSL specification:

It is typical to consider a square of 2x2 fragments or samples and calculate an independent dFdxFine for each row and an independent dFdyFine per column when calculating only one dFdxCoarse and one dFdyCoarse for the entire 2x2 square.

- . , , , dFdx(a). 2x2 (.. ):

    a00  a10
    a01  a11

a, . :

dFdxFine(a) = (a10 - a00)/dx       at xy = 00, 10
dFdxFine(a) = (a11 - a01)/dx       at xy = 01, 11

2x2 . , :

dFdxCoarse(a) = (a10 - a00)/dx     at xy = 00, 10, 01, 11

, . , "" . . dFdx dFdy, ( ).

+5

Source: https://habr.com/ru/post/1655110/


All Articles