Blinn-phong shading...?
So the issue I'm having, as the above image hopefully illustrates, is that I can't seem to get my specular highlights to shade smoothly. The problem is the abrupt cutoff along face edges, which shouldn't be happening. The diffuse lighting appears to be working quite well, and it uses the same interpolated values. Here's the code for the blinn-phong specular highlights:
vec3 halfAngle = normalize(lightDirection.xyz + viewRay);
float blinnTerm = dot(normal.xyz, halfAngle);
blinnTerm = clamp(blinnTerm, 0.0f, 1.0f);
blinnTerm = pow(blinnTerm, 300.0f);
float specIntensity = intensity * blinnTerm;
vec4 specColour = specIntensity * specColour;
lightDirection
is constant, it's infinitely far away (ie. the sun). As for viewRay, it's computed in the vertex shader like so, using the projection matrix:
viewRay = vec3(-(UV.x * 2.0f - 1.0f) / projection[0].x,
-(UV.y * 2.0f - 1.0f) / projection[1].y,
1.0f);
I'm using deferred rendering, which is where the UV values come from (rendering to a full screen texture).
The only thing I can think of is that the normal interpolation just isn't smooth enough. But if that's the case, how would I go about fixing it? (I'm storing the normals as 16-bit floats, but upping it to 32 bits didn't make a difference).