The original specular highlight rendering is based on a single function that is described on the water mathematics page (HERE). The generic idea is using a trigonometric function of the light-direction vector. If the distorted reflection is close enough to the light direction the highlights get visible.

*Vector L points towards the light-source, V towards the viewer, N is the normal-vector of the surface, R is the direction of reflection while H halves the angle between L and V.*

If ß is the angle between N and H, the basic function looks like this:

, but this value can be calculated using the vectors and their dot product as well:

In the HLSL code it looks something like this

`float alpha= pow( dot(halfVector,normalVector), specPower);`

Pretty simple, isn't it? The first problem, that this solution handles every direction in the same way and causes this specular highlight (still not using distortion):

If we apply some distortion, this can look more-or-less convincing, but we want something better. If we modify the Z value of the vectors before the same calculations we can adjust the shape of the highlight. What happens is we divide the Z values by 10? The same trigonometric functions will result an elliptic-shaped specular highlight, whose longer diagonal is 10 times longer than the shortest one, and that longer diagonal is always pointing towards the sun.