I have a terrain system set up which utilizes a quad tree and a gray scale height map to draw the terrain. I create one 64x64 flat triangulated grid, which is then drawn at various scales based on the quad tree node selection. In the vertex shader, I sample a 2048 x 2048 height map texture to obtain the y coordinate for the grid mesh. Here is the code used to sample the grayscale texture:
float3 CDLODSample(Texture2D hmText, Texture2D gDetTexture, float3 inPos){
inPos.y = hmText.SampleLevel(gTriLinearSampler,
(inPos.xz*gsamplerWorldToTextureScale.xy)+gquadOffset._m00_m01,0.5f).x;
return inPos;
}
I then scale the result of this sample by a constant to determine the height variation of the terrain. The issue is that as the size of the terrain increases (up-scaling the terrain to 16,384 x 16,384), the terrain appears jagged and low quality. Although there are still plenty of vertices, the vertices simply form larger, visible polygons. I have read about bezier surfaces and re-sampling algorithms, but these seem very costly in terms of performance. Is there a good way to dynamically re-sample terrain for a smoother output without hurting performance too much? If so, does Direct X have a sampler which will do something like this? How do games such as Battlefield 4 and Just Cause support large, smooth terrains with huge height variation? Do they simply stream very large height maps, or do they dynamically re-sample lower resolution height maps as needed? Any and all information and tips are much appreciated.