I am trying do the Blinn-Phong lighting in my shaders. The result more or less looks right:

But I am getting some artifacts:

I think I am making some errors in computing my Halfvector, the code is as follows:

Vert:

```
void main()
{
//1.0 transform the normal
vryNormal = normalize(uniNormalMtx * attrNormal);
//2.0 calculate the light direction
for(int i=0; i< MAX_LIGHTS; i++)
{
if(uniLight[i].initialised == true)
vryLightDir[i] = vec3(uniModelViewMtx * uniLight[i].position);
}
//3.0 set the texture coordinate
vryTexCoord = attrTexture;
//transform the vertex
gl_Position = uniModelViewProjectionMtx * attrVertex;
// transform light and half angle vectors by tangent basis
vryEyeVec = (uniModelViewMtx * -attrVertex);
//set the basic colour
vryFrontColour = attrColour;
}
```

Frag:

```
void main()
{
vec4 ambient = vec4(0.0, 0.0, 0.0, 0.0);
vec4 diffuse = vec4(0.0, 0.0, 0.0, 0.0);
vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);
for(int i=0; i< MAX_LIGHTS; i++)
{
if(uniLight[i].initialised == true)
{
vec3 half_vector = normalize((vryLightDir[i] + normalize(vryEyeVec)));
DirectionalLight(i, normalize(vryNormal), normalize(vryLightDir[i]), half_vector, ambient, diffuse, specular);
}
}
vec4 colour = ambient * uniMaterial.ambient
+ diffuse * uniMaterial.diffuse;
colour += specular * uniMaterial.specular;
gl_FragColor = colour;
}
```

where uni are uniforms to replace the gl stuff (the names are hopefully obvious), vry are varying.

This is only for directional lighting just now (DirectionalLight is the standard function from the Orange Book)

Are the calculations for the halfvector correct? Thanks for any help.