只能用在片段着色器。
w = fwidth(uv);
w.x = abs(dFdx(uv).x);
w.y = abs(dFdy(uv).y);
genType fwidth( genType p);
genType fwidthCoarse( genType p);
genType fwidthFine( genType p);
p
Specifies the expression of which to take the partial derivative.
Available only in the fragment shader, these functions return the sum of the absolute derivatives in x and y using local differencing for the input argument p. fwidth is equivalent to abs(dFdx(p)) + abs(dFdy(p)) . fwidthCoarse is equivalent to abs(dFdxCoarse(p)) + abs(dFdyCoarse(p)) . fwidthFine is equivalent to abs(dFdxFine(p)) + abs(dFdyFine(p)) .
本文详细解析了片段着色器中fwidth、fwidthCoarse及fwidthFine函数的应用。这些函数用于计算输入参数的局部偏导数绝对值之和,适用于纹理映射和效果实现。
6861

被折叠的 条评论
为什么被折叠?



