Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Could anybody explain dFdx and dFdy for me?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2004
    Posts
    5

    Could anybody explain dFdx and dFdy for me?

    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
    'F' defined?

    thanks a lot...

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: Could anybody explain dFdx and dFdy for me?

    dFdx and dFdy give you the change of a value in fragment shader. For example
    dFdx(my_texcoord)
    will tell you how this value changes in x-direction on the screen.
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2004
    Location
    Melbourne, Australia
    Posts
    5

    Re: Could anybody explain dFdx and dFdy for me?

    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.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Sep 2000
    Location
    SWEDEN
    Posts
    718

    Re: Could anybody explain dFdx and dFdy for me?

    The supplied genType (p) 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •