I notice today, that the reflect function of the VectorMath node, uses the Normal as if it was a surface Tangent.
In mathematical terms, the reflected vector is supposed to be R = 2*dot(I, N) - I;;
But I quickly discovered that the fuctions reflect_v3_v3v3()(blenlib/intern/math_vector.c), reflect()(cycles/util/util_math_float3.c) and reflect()(cycles/kernel/shaders/stdosl.h), they all output R = I - 2*dot(I, N);
In math_vector.c, it was even added an ascii graphic and a note that for ābouncingā we should negate the resultā¦
Going further, since stdosl.h should be very similar to the one from ImageWorks, I found out that they did the same thing (and also a clarification in the specs).
I wonder why this choice? Is there any reason to output the inverted vector (instead of the real āreflectedā one)?
The operation of exchanging all points of a mathematical object with their mirror images (i.e., reflections in a mirror).
ā¦
The term reflection can also refer to the reflection of a ball, ray of light, etc. off a flat surface.
But is there a reason to do it like this?
I find it a bit strange to use vectors that donāt start in the origin⦠Formula (3) explicitly says X1' - X0.
Ok⦠Thanks for the answer.
I can keep using -I (or -reflect(I, N)) for calling the function, thought it seems that is just one extra step to get a more usefull vector.