I have a terrain based on CDLOD paper. It uses a single static mesh that is scaled & dynamically morphed to progress between LOD levels (marked by different colors)


I compute the world position of each vertex to sample the heightmap.
float2 GetTextureCoordinates( float3 worldPos )
{
float2 texcoord = ( worldPos.xz - gWorldMin ) / ( gWorldMax - gWorldMin );
texcoord = clamp( texcoord, 0.0f, 1.0f );
return texcoord;
}Currently I use a compute shader to generate a normal map like this
#ifndef TERRAIN_COMPUTE_NORMAL_HLSL
#define TERRAIN_COMPUTE_NORMAL_HLSL
#include "Constants.hlsl"
#include "Common.hlsl"
Texture2D gHeightmap : register( TEXTURE_REGISTER_EXTRA );
RWTexture2D<float3> gNormalTexture : register( UAV_REGISTER );
[numthreads(TERRAIN_NORMAL_THREADS_AXIS, TERRAIN_NORMAL_THREADS_AXIS, 1)]
void cs_main(uint3 groupID …