Open singalen opened 2 years ago
It'd be helpful to add a note after the definition about how GLSL actually implements smoothstep
in a way that reverse the output to [1, 0] when the left side is greater than the right side. I looked at the code and tried to understand how it actually worked but apparently not complying with what the definition said.
The GLSL spec does say "Results are undefined if edge0 >= edge1." The lesson learned in this section is the specs do not define what is actually implemented. It took me a bit for that to sink in.
https://thebookofshaders.com/glossary/?search=smoothstep says "Results are undefined if edge0 ≥ edge1".
At the same time, https://thebookofshaders.com/05/ uses
smoothstep(0.02, 0.0, ...)
.NVidia reference says:
which actually explains why and how the code works.