SMOOTHSTEP(3G)

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

✨ SMOOTHSTEP ✨ (a 3G moment, bestie)

okay so real talk, this is the manual page for smoothstep, and it lives in section 3G of the manual. she's a GLSL girlie, she's iconic, and she's about to make your thresholds look ✨expensive✨.


🌸 NAME 🌸

smoothstep β€” perform Hermite interpolation between two values


πŸŽ€ DECLARATION πŸŽ€

like, here's the whole lineup, copy-paste ready:

genType smoothstep(genType edge0, genType edge1, genType x);

genType smoothstep(float edge0, float edge1, genType x);

genDType smoothstep(genDType edge0, genDType edge1, genDType x);

genDType smoothstep(double edge0, double edge1, genDType x);

πŸ¦‹ PARAMETERS πŸ¦‹

  • edge0 β€” the value of the lower edge of the Hermite function. the bottom of the vibe window 🫢
  • edge1 β€” the value of the upper edge of the Hermite function. the top of the vibe window πŸ’…
  • x β€” the source value you're interpolating from. the main character of the equation, no cap πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

okay so smoothstep does smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1. literally the moment when your value is chillin' inside the window and she hands you a buttery-smooth number instead of a harsh jump. this is the serve when you want a threshold function with a smooth transition β€” no jagged edges, only vibes 🌈

smoothstep is equivalent to exactly this, and I mean exactly:

genType t;  /* Or genDType t; */
t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
return t * t * (3.0 - 2.0 * t);
🚨 warning, bestie, this one matters: results are undefined if edge0 β‰₯ edge1. like, don't do it. she will not save you. that's a chaos moment, not a slay moment πŸ’€

πŸ‘‘ VERSION SUPPORT πŸ‘‘

the table didn't survive the glow-up (no tables in this chat, sorry πŸ₯Ί) but every single cell did, i promise. βœ” means she's supported, - means she isn't there yet.

smoothstep (genType) β€” across OpenGL Shading Language Version 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50:

  • 1.10 β€” -
  • 1.20 β€” -
  • 1.30 β€” βœ”
  • 1.40 β€” βœ”
  • 1.50 β€” βœ”
  • 3.30 β€” βœ”
  • 4.00 β€” βœ”
  • 4.10 β€” βœ”
  • 4.20 β€” βœ”
  • 4.30 β€” βœ”
  • 4.40 β€” βœ”
  • 4.50 β€” βœ”

smoothstep (genDType) β€” same twelve versions, same order:

  • 1.10 β€” -
  • 1.20 β€” -
  • 1.30 β€” -
  • 1.40 β€” -
  • 1.50 β€” -
  • 3.30 β€” -
  • 4.00 β€” βœ”
  • 4.10 β€” βœ”
  • 4.20 β€” βœ”
  • 4.30 β€” βœ”
  • 4.40 β€” βœ”
  • 4.50 β€” βœ”

so like, genType showed up in 1.30 and genDType was fashionably late to the party in 4.00. we respect the journey πŸ•βœ¨


πŸ”₯ SEE ALSO πŸ”₯

  • mix()
  • step()

go read those too, they're her sisters and they also ate πŸ’…


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!! πŸŽ€ source situation is the ever-mysterious [FIXME: source], dated 01/03/2018, and this whole thing is filed under SMOOTHSTEP(3G) β€” go forth and interpolate smoothly, ily πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from