OK, I found the reason why the reflection wasn't moving, wmit.vert row 64:
Code: Select all
halfVec = normalize(lightDir) + normalize(-eyeVec);
I had to normalize lightDir and eyeVec, since they are not unit vectors. It seems to me that eyeVec was very small compared to lightDir and thus the half vector was shifted almost entirely towards lightDir. Not sure why I had to invert eyeVec though... oh well, such is life with wz's coordinate system.
Also one thing that I mentioned some time in the distant past, is the way lightDir is calculated. All of warzone's shaders calculate it as
Code: Select all
lightDir = lightPosition.xyz - vVertex;
This is the calculation for a point light. Then the position of the light is moved far, far away to simulate the sun, whose light rays are (for our purposes) perfectly parallel. This reduces the contribution of vVertex to the point where the result is identical with
which is the code for a directional light, i.e. what we all wanted in the first place, except with this code you don't need to give it a huge magnitude.
Edit:
It seems like I have too many versions of the shaders and these issues have already been addressed in other shaders I have which I think are from you