REFLECT(3G)

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

πŸ’– REFLECT πŸ’–

okay so bestie, welcome to REFLECT(3G) β€” yes that's the 3G manual section, we're in OpenGL shading language territory, and no cap this one is lowkey iconic πŸ¦‹


✨ NAME ✨

reflect β€” bestie, it literally calculates the reflection direction for an incident vector πŸ’…


πŸŽ€ DECLARATION πŸŽ€

here's the vibe check, copy it exactly:

genType reflect(genType I, genType N);

genDType reflect(genDType I, genDType N);

two flavors, one for genType, one for genDType, slay ✨


🌸 PARAMETERS 🌸

  • I β€” the incident vector, aka the one that's about to hit the surface 🫢
  • N β€” the normal vector, the surface's whole personality 😌

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea. give it an incident vector I and a surface normal N, and reflect hands you back the reflection direction, and the math is literally:

I - 2.0 * dot(N, I) * N

that's it, that's the formula, no notes πŸ’…

⚠️ not me forgetting this: N should be normalized in order to achieve the desired result. like, fr fr, normalize your N or the result is not giving what it's supposed to give. consider this your gentle reminder bestie πŸ’–

⭐ VERSION SUPPORT ⭐

here's the whole era-by-era breakdown, every single version accounted for:

  • reflect (genType) β€” ate in literally every single one: 1.10 βœ”, 1.20 βœ”, 1.30 βœ”, 1.40 βœ”, 1.50 βœ”, 3.30 βœ”, 4.00 βœ”, 4.10 βœ”, 4.20 βœ”, 4.30 βœ”, 4.40 βœ”, 4.50 βœ” β€” main character energy from day one πŸ‘‘
  • reflect (genDType) β€” she was not there early, and that's okay: 1.10 -, 1.20 -, 1.30 -, 1.40 -, 1.50 -, 3.30 -, and then boom πŸ’₯ 4.00 βœ”, 4.10 βœ”, 4.20 βœ”, 4.30 βœ”, 4.40 βœ”, 4.50 βœ” β€” a glow up honestly πŸ¦‹

πŸ”₯ SEE ALSO πŸ”₯

  • dot()
  • refract()

go give them a read, they're the besties of this function, iykyk πŸ’œ


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


πŸŽ€ and that's the whole page bestie!! this one came from [FIXME: source], dated 01/03/2018, and it's the REFLECT(3G) page β€” thanks for reading, you're doing amazing sweetie, drink some water and normalize your normals πŸ’–βœ¨πŸ«Ά
πŸ“¦ where this page comes from