FWIDTH(3G)
π FWIDTH π (section 3G, she's giving graphics-shader realness)
okay so bestie, gather round, because today we're talking about fwidth from manual section 3G. yes the manual name is right there in the title, we're not copying the whole header line, we're just vibing. periodt. β¨
πΈ NAME πΈ
fwidth β return the sum of the absolute value of derivatives in x and y
like, it's a derivative-summing girlie and she's built different, no cap π
π DECLARATION π
here's exactly what she looks like when you summon her, copy these character for character bestie:
genType fwidth(genType p);
genType fwidthCoarse(genType p);
genType fwidthFine(genType p);
three flavors. one iconic family. obsessed π¦
π PARAMETERS π
pβ the expression you wanna take the partial derivative of. that's it, that's the whole assignment. she's the input, you're the one deciding what gets differentiated π
β¨ DESCRIPTION β¨
okay so here's the tea β β these functions are available only in the fragment shader. like, fragment shader only, don't try her anywhere else, she will not show up. π
what they do: they return the sum of the absolute derivatives in x and y, using local differencing, for the input argument p.
and here's the equivalence breakdown, because the way that these are literally just other functions added together is so satisfying:
fwidthis equivalent toabs(dFdx(p)) + abs(dFdy(p))fwidthCoarseis equivalent toabs(dFdxCoarse(p)) + abs(dFdyCoarse(p))fwidthFineis equivalent toabs(dFdxFine(p)) + abs(dFdyFine(p))
see? abs + abs. she's an absolute value girlie twice over and honestly? slay. π₯
π VERSION SUPPORT π
the glow-up timeline, aka which OpenGL Shading Language Version said "yes queen" to each function. βοΈ means she ate, - means she wasn't invited yet π
π§ fwidth
- 1.10 β β
- 1.20 β β
- 1.30 β β
- 1.40 β β
- 1.50 β β
- 3.30 β β
- 4.00 β β
- 4.10 β β
- 4.20 β β
- 4.30 β β
- 4.40 β β
- 4.50 β β
she's been here since the beginning and she's never leaving. main character energy fr fr π
π¦ fwidthCoarse, fwidthFine
- 1.10 β
- - 1.20 β
- - 1.30 β
- - 1.40 β
- - 1.50 β
- - 3.30 β
- - 4.00 β
- - 4.10 β
- - 4.20 β
- - 4.30 β
- - 4.40 β
- - 4.50 β β
ngl the coarse/fine duo showed up fashionably late β literally nothing until 4.50 and then bam, both of them at once. iconic entrance honestly π
π SEE ALSO π
dFdx()
(go say hi, she's the whole reason fwidth works the way she does. iykyk π«Ά)
π COPYRIGHT π
Copyright Β© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
π COPYRIGHT π
Copyright Β© 2011-2014 Khronos Group
and that's the whole page bestie π
the source is [FIXME: source], the date on it is 01/03/2018, and it belongs to manual section 3G. we love a slightly-unfinished source tag, she's got mystery, she's got aura πΈ bye pookie, go call dFdx() π¦π
π¦ where this page comes from
- ubuntu jammy: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- ubuntu noble: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms