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)?