I am using hardware tesselation to render a large landscape, that means, the tess-evaluation shader is reading a height-value from a texture, which works fine. But I also need normals for each tesselated vertex and I would like to calculate these on the fly, instead of storing them in another texture. Reason for this is, I want to be able to switch to procedural landscape, where the height-value is the output of some noise-function.
My idea is to have something like dFdx() inside the eval-shader to get the derivates of vertex-positions, but I haven’t found such thing in current the GL/GLSL spec.
As work-around I am currently using a geometry-shader to calculate per-face normals. But that doesnt look smooth of course.
Any Ideas of how to get normals? Other Ideas welcome.