Concerning dFd{x, y}() in GLSL

dFdx()和dFdy()在GLSL中用于计算片段间特定属性的导数。它们基于屏幕空间中相邻片段的位置,用于计算如纹理坐标等变量的差值。常量作为参数时返回值为零。建议使用变化量作为参数,并且可以与textureGrad()结合使用进行图像处理。示例展示了如何使用dFdx()和dFdy()实现Sobel边缘检测和Laplacian滤波。
摘要由CSDN通过智能技术生成
dFdx(fragAttrib) and dFdy(fragAttrib) compute derivatives of certain given attribute between two adjacent fragments.
If currently being processed fragment is f(x, y), x and y refer to the position of this fragment in SCREEN SPACE, then

    1. dFdx(fragAttrib) calculates the derivative of "fragAttrib" between f(x, y) and f(x+1, y), atually is the "fragAttrib" value of f(x+1, y)
subtracted by the value of "fragAttrib" of f(x, y);

    2. dFdy(fragAttrib) calculates the derivative of "fragAttrib" between f(x, y) and f(x, y+1), atually is the "fragAttrib" value of f(x, y+1)
subtracted by the value of "fragAttrib" of f(x, y);


///
CAUTION!
    1. Since dFd{x, y}() are used to compute derivatives, so if a constant is the parameter, the return value is permanently ZERO!

    2. The prototype is genType dFd{x, y}(genType fr
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值