recp / cglm

📽 Highly Optimized 2D / 3D Graphics Math (glm) for C
MIT License
2.2k stars 229 forks source link

refract implementation #422

Closed gottfriedleibniz closed 3 weeks ago

gottfriedleibniz commented 1 month ago

Believe the current refract implementation is mixing up the signs. Referencing GLSL: $K = 1.0 - \mu^2 (1.0 - (N \boldsymbol{\cdot} I)^2)$, which would imply 1.0f - eta * eta + eni * eni; in code.

recp commented 1 month ago

Hi @gottfriedleibniz,

Sorry for the delay, thanks for the catch 🤗

https://github.com/recp/cglm/commit/48839a38a14a653c233693fa911348ce58d57167 should fix that