-
-
Notifications
You must be signed in to change notification settings - Fork 745
Chapter 05 non-standard use of smoothstep #418
Copy link
Copy link
Open
Description
Hi, the first code example in Chapter 05 contains a usage of smoothstep which should produce undefined output according to the OpenGL docs.
// Plot a line on Y using a value between 0.0-1.0
float plot(vec2 st) {
return smoothstep(0.02, 0.0, abs(st.y - st.x));
}
It looks like, on my hardware, the result ends up being identical to:
float plot(vec2 st) {
return 1.0 - smoothstep(0.0, 0.02, abs(st.y - st.x));
}
But according to the OpenGL docs (and the documentation for the smoothstep function contained in the Book of Shaders) this function requires edge1 to be strictly greater than edge0. Being new to shaders, this confused me and I had to mess around with it to figure out what was actually happening.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels