This terrain shader is a little project I made while I was working on an XNA engine. The terrain is drawn as a heightfield that is completely build together within the vertex shader. A 16x16 triangle grid is send to the GPU and, using hardware instancing, it is duplicaded and transformed to create the terrain. Using a color channel texture, 4 different textures can be smoothly blended over the surface.
Download the XNA shader code example here.