Mittwoch, 29. Januar 2014

Geometry Clipmaps Terrain Rendering Tutorial Source Code

Today I completed the ClipMap rendering by adding culling to the terrain chunks.
The speed is at 1000-2000 fps now. The source is a bit longer but stayed around 200 lines for the main algo, which is easy to overview.

You can fetch the source code and executables here:
[-Download-ZIP-] (Textured Version older shader support, 32/64 bit) (Newest)
[-Mirror-] (Gamedev)

License is MIT

Key settings:
Space : wireframe view
Enter : Top-down view

Since there are many libs out there that have a completely bloated and unusable source code, I think its useful for everybody wanting to get started with terrain.


  1. I have a hard time seeing your triangles. I can see that the lines get further away from each other as the detail gets lowered, but I can't see the triangles, even in wireframe mode.

  2. yes, its shown in lines. if you want triangles, you can change GL_LINES to GL_LINE_STRIP in line 198 - but it doesnt look nice due to degenerated triangles that are used.

  3. Hi! This is very cool work
    I study "geometry clipmaps" with your code
    Can you explain more detail about variables cs, zp,xm,xp,ym,yp?

    1. Thx. zp,xm,xp,ym,yp are x minus x plus etc. They count the vertices of the bounding box that are out side the frustum in x,y,z plus/minus

    2. Sorry But can i ask few question? In Code. which make quad patch after load shaders. Can you explain this part? this is save about what?