I'm trying to get a terrain shader working and I am having problems re-calculating the normals. Here's my shader at the moment:
I'm using a technique I discovered in a paper to determine the normal to the terrain using the heightmap data that sets the height of each vertex in a 2D plane. The problem is that the shading is still totally flat and the normals still point directly up, as they do in the original plane. Can anyone see why? Should I be doing the normal calculation in the pixel shader (which I also tried, doesn't work either).
Here's how the terrain looks: