Hi,
I have a varying vec3 called tbnDirToLight passed into my fragment shader.
Anyone know why the following two bits of code in the fragment shader produce radically different results?
vec3 tbnNormDirToLight = normalize(tbnDirToLight);
does not produce the same result as:
vec3 tbnNormDirToLight = tbnDirToLight;
normalize(tbnNormDirToLight);
My initial thoughts are that the normalize function must change the vector passed to it rather than returning a new vector and leaving the input one unchanged.
and as varyings in frag shaders can't be changed, something undefined is happening.
but this would be odd as countless shader tutorials (from lighthouse3d, openGL forums etc.) use the first form of this code.
Any thoughts?