Could anybody explain dFdx and dFdy for me?
I have read 3dLabs’s glslang spec for these
two functions but undertand nothing:(
The spec says:
These two functions are commonly used to estimate
the filter width used to anti-alias procedural
textures.We are assuming that the expression is being
evaluated in parallel on a SIMD array so that at any
given point in time the value of the function is known
at the grid points represented by the SIMD array.
Local differencing between SIMD array elements can
therefore be used to derive dFdx, dFdy, etc.
What does this mean?
for genType dFdx (genType p)
What does ‘p’ stand for? The input for
the function ‘F’? And where is function
thanks a lot…
dFdx and dFdy give you the change of a value in fragment shader. For example
will tell you how this value changes in x-direction on the screen.
As I understand it, the parameter passed to dFdx should be a varying. So then dFdx is an indication of the speed of change of this variable on the primitive with respect to x screen coordinates. The derivatives only apply for each primitive (triangle) so that points along the edge may not have very good derivatives.
The supplied genType § doesn’t need to be varying, derivatives are computed by differencing like it says in the description. You can use this to get normals from a bump map for example.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.