Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glm_vec4_smoothstep #1222

Closed
gottfriedleibniz opened this issue Jan 17, 2024 · 0 comments · Fixed by #1250
Closed

glm_vec4_smoothstep #1222

gottfriedleibniz opened this issue Jan 17, 2024 · 0 comments · Fixed by #1250

Comments

@gottfriedleibniz
Copy link

glm_vec4_smoothstep incorrectly computes 't'. Per GLSL:

genFType t;
t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t);

Stepping through the function

glm_vec4 const sub0 = glm_vec4_sub(x, edge0);      // (x - edge0)
glm_vec4 const sub1 = glm_vec4_sub(edge1, edge0);  // (edge1 - edge0)
glm_vec4 const div0 = glm_vec4_sub(sub0, sub1);    // (x - edge0) - (edge1 - edge0); should be divide
glm_vec4 const clp0 = glm_vec4_clamp(div0, _mm_setzero_ps(), _mm_set1_ps(1.0f));
/// ...
This was linked to pull requests Feb 8, 2024
@christophe-lunarg christophe-lunarg removed a link to a pull request Feb 8, 2024
Zuzu-Typ pushed a commit to Zuzu-Typ/glm that referenced this issue Oct 11, 2024
Zuzu-Typ added a commit to Zuzu-Typ/glm that referenced this issue Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants