FACEFORWARD(3G)
okay bestie, pull up a chair π«Ά this is faceforward, and it lives in section 3G of the manual. it's a lil GLSL icon and honestly it's giving "tiny function, big feelings." let's get into it π
β¨ NAME β¨
faceforward β returns a vector pointing in the same direction as another. that's it. that's the whole personality. no cap.
πΈ DECLARATION πΈ
here's the exact shape of it, don't freestyle these:
genType faceforward(genType N, genType I, genType Nref);
genDType faceforward(genDType N, genDType I, genDType Nref);
π PARAMETERS π
Nβ bestie this is the vector you wanna orient. the one getting flipped around.Iβ the incident vector. it's the vibe-check-er, lowkey.Nrefβ the reference vector. the blueprint. the moment.
π¦ DESCRIPTION π¦
so what does it actually do? faceforward orients a vector to point away from a surface, as defined by its normal. literally its whole job is making sure the vector faces outward and not into the void π
the logic? if dot()(Nref, I) < 0, faceforward returns N. otherwise it returns -N.
that's the entire decision tree. she's simple, she's effective, she ate π
π VERSION SUPPORT π
ngl this is the part where the original flexes a whole grid at you. here it is, un-gridded but with zero facts dropped, periodt:
faceforward (genType) β iconic in EVERY version, no skips
- OpenGL Shading Language Version
1.10β β - OpenGL Shading Language Version
1.20β β - OpenGL Shading Language Version
1.30β β - OpenGL Shading Language Version
1.40β β - OpenGL Shading Language Version
1.50β β - OpenGL Shading Language Version
3.30β β - OpenGL Shading Language Version
4.00β β - OpenGL Shading Language Version
4.10β β - OpenGL Shading Language Version
4.20β β - OpenGL Shading Language Version
4.30β β - OpenGL Shading Language Version
4.40β β - OpenGL Shading Language Version
4.50β β
faceforward (genDType) β late bloomer energy π±
- OpenGL Shading Language Version
1.10β- - OpenGL Shading Language Version
1.20β- - OpenGL Shading Language Version
1.30β- - OpenGL Shading Language Version
1.40β- - OpenGL Shading Language Version
1.50β- - OpenGL Shading Language Version
3.30β- - OpenGL Shading Language Version
4.00β β - OpenGL Shading Language Version
4.10β β - OpenGL Shading Language Version
4.20β β - OpenGL Shading Language Version
4.30β β - OpenGL Shading Language Version
4.40β β - OpenGL Shading Language Version
4.50β β
so like, genDType didn't show up until 4.00 and then she arrived and immediately understood the assignment. queen behavior π
π SEE ALSO π
reflect()refract()
go read those too, they're the friend group π«Ά
π 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 (yes, again, bestie) π
Copyright Β© 2011-2014 Khronos Group
aaaand that's the page π this was [FIXME: source], dated 01/03/2018, and it's filed under FACEFORWARD(3G). mwah, go flip some vectors the right way around β¨π
π¦ 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