How can we calculate "Eye position"in modern code? reports that half vector in OpenGL context is ‘Eye position - Light position’ but then it goes on to say ‘luckily OpenGL calculates it for us’, which is now deprecated.

How can, practically Half Vector be calculated? Mainly, it puzzles me what “Eye” is and how it can be derived.

Peculiar: at the moment I managed to make specular calculations work (with good visual result) with half vector being equal to Light where Light is

vec3 Light = normalize(light_position - vec3(out_Vertex));

Now, I’ve no idea why that worked.

If I knew what “Eye” is and how it can be derived practically it may shed more light.

Eye refers to the camera shooting the scene.
You can get the position of the camera from the 4th column of your view matrix.
What version of OpenGL/GLSL are you using ? How do you build your matrices ?

You need the eye to vertex vector.

This is the coordinate of the vertex position after transformation through the modelview matrix but before the transformation through the projection matrix.

A common approach os to split your transform into modelview and projection and use the intermediate value for the vector calculation. (There are many other options of varying degrees of efficiency and application complexity).

Your code snippet is merely calculating the light vector, the key issue is what space the vectors are transformed to when you do it (again there are many options).

Note it’s not clear that you actually produced a half vector (which is a hack to turn circular specular highlights into elongated lobes). So many vectors will produce a specular effect, but that doesn’t mean it will be correct of match Blinn’s. Of course if you’ve copied this from somewhere then it may be that someone has rigged positions and matrices to somehow be equivalent, I doubt it though.

Hmmm… looking again this is only for local light sources, so all this is doing is calculating the local light vector.

This is then used for the half vector using the transformed vertex position.

So you’re not showing where Light is used with View (vertex position) to generathe the half vector, you’re only showing where the local light vector used later is generated.

It’s as clear as mud with a single line of code.

All input matrices, vectors and operation order are essential to understanding what’s going on.

And remember that a variable might be reused so if out_Vertex were storing the negative View Vector and Light_position the vector to light then we’re looking at a different part of the equation to produce the Half angle.

It’s not really that tricky right. Again key to understanding is knowing the space you’re doing the math in and understanding that in some spaces the position IS the view vector (or negative to view vector depending on nomanclature).