![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFD-PFCG0V2jjg3sHUZBdCCZa11ckRyFHU7fofCBBOdgKe7BpFzndNAQx8ufQ8jYvInXOAqfATLMvFmlG-URaQGoJvk00p47IYtweVkE1MzDU6LNVtP5MW9ZAS2eD_XhqtpYgzsbPk52sA/s320/terrain1.jpg)
To workaround this issue, we need a method to perfrom terrain rendering with CLOD. The concept of CLOD (Continuous Level of Detail) is not too difficult to understand, basically more details are preserved in the areas closer to the camera view than the farther ones. The key is to maintain real-time rendering performance while not sacrificing too much graphic quality.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJunYFOF6w6p-zYd98ALM8QrWKnaOjSKTgYh-T3QHSo_a2kLMyGM8sPjmYklIQoJ_-NoKvX_RKpAx7O0wo23VUcHX0xQK4deiQsDqSO-3S2ubz76EgC-xOr98XcZmx-EbM-nuSPDGFhtti/s320/terrain2.jpg)
Essentially the whole terrain area is splitted into many smaller terrain blocks. Each block stores a vertex buffer and multiple levels of index buffers, which represent the terrain block at different resotluion. These computations are done at load-time, and during run-time, based on value of pixel-error / distance factor, a suitable LOD is selected to render the terrain block.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqXYb7Ef3rahF90qU8QzXvZRovjuXxFnV5GS-3fJVDZxsUlcXcA4Y04tpACDljnHwNaQpFiW85AzwYuCnmsp3BwnmyQSESw_MAQlBxM3_CIpoo7TFs3sdTUgZYDMXum4UNCzfqs8DrSh1f/s320/terrain3.jpg)
One of the major issue with this approach is the gap formed when blocks of different LODs are adjacent, because the shared edges are represented by different numbers of vertices belonging to each block. To seal these gaps, the index buffer of the higher LOD block is re-computed at run-time to reduce the resolution to match that of the lower LOD block, thus effectively sealing up the gaps.
The end result is the capabilty to render an area made of 2M triangles at full resolution with roughly 20k triangles made of various LOD blocks.
Highlights:
Highlights:
- OpenGL API.
- Geo-Mipmapped Terrain.
- Vertex and Index Buffer.
- Gap-filling between terrain blocks.