Displacing vertices based on a heightmap
The first two images show the full terrain in solid and wireframe modes with the default height modifier. In my program I made the height modifier change dynamically based on user input. The other three images show the same terrain with the height modifier decreased, increased and negated.
Mapping heights to colors
Uniform tessellation
I said earlier that the heightmap vertex displacements could be done through the vertex shader. They can also be done through the domain shader after tessellation, as I've done here, since the domain shader is essentially just a vertex shader for vertices created through tessellation.
An even more interesting concept is changing the level of tessellation (i.e. the tessellation factor sent from the hull shader to the tessellator stage) non-uniformly, perhaps based on proximity to the player or camera. I did that too, which I'll talk about in my next post.
The Sobel Filter
I mentioned edge detection earlier. Having sussed out the Sobel filter and got it working, I thought I might as well use it for edge detection as well. When the toggle for the Sobel filtering is turned on, the scene is no longer directly rendered to the frame buffer and is instead rendered to a texture (basic post-processing stuff). I then render a quad with that texture applied to it to the frame buffer, using a pixel shader which applies the Sobel filter. The results look pretty cool, with edges highlighted and faces blackened (and yes, I did just take the test image from the Sobel filter Wikipedia page).