In the documentation of GLSL - reflect given a surface normal $N$ and an incident vector $I$ the calculation being performed is reported as $$ \text{reflect}(I,N) = I - 2\text{dot}(I,N)N $$

I wonder if this math is correct because in my calculations the sign should be swapped.

Can anyone confirm?

Maybe if $I$ is not incident but outgoing from the point of application the sign would be swapped?

  • 1
    $\begingroup$ This question pops up from time to time here, the math is correct. $\endgroup$
    – pmw1234
    Dec 26, 2023 at 23:37


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.