FACEFORWARD(3G)

πŸ“¦
version 1.0~svn33624 Β· 4 versions
, in ubuntu jammy, ubuntu noble

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 Β© 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 Β© 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