Modern OpenGL terrain rendering for learning purposes.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 59b1afa Apr 17, 2017
Permalink
Failed to load latest commit information.
OpenGLFramework Readme formating. Jan 4, 2016
TerrainApp Readme formating. Jan 4, 2016
TerrainAppWorkingDir First Commit. Jan 3, 2016
.gitignore First Commit. Jan 3, 2016
LICENSE Create LICENSE Feb 26, 2017
OpenGL.sln Update OpenGL.sln Jan 3, 2016
README.md Update README.md Apr 17, 2017

README.md

opengl-terrain-demo

Modern OpenGL terrain rendering for learning purposes. Dependencies: Assimp, DevIL, glew, glfw, glm.

Controls:

O, P -> Terrain height scale

K, L -> Target screen space triangle area (control tesselation)

G -> Toggle wireframe

F -> Toggle fog

1, 2, 3 -> Choose terrain (heightmap and normalmap)

0 -> Choose texturing mode (height/slope based and slope-only based)

Left Alt -> Toggle vsync

Youtube Video

Windows Executable

Requires driver support for OpenGL 4.5.

Details:

  • Developed with C++, OpenGL and GLSL 4.5.
  • Base framework abstracting and simplifying the use of OpenGL objects: buffers, textures, VAOs, FBOs and shaders. Abstracts mesh and texture loading. Also helps with the management of scene objects and their respective meshes and materials.
  • The terrain is defined through a height map and a normal map.
  • Terrain has adaptative hardware tessellation (trying to generate triangles with the same screen-space area). Based on nVidia's Paper DirectX 11 Terrain Tesselation.
  • Multitexturing based on two criteria: altitude and slope.
  • GPU frustum culling is applied to the terrain on a patch level, on the tesselation control shader.
  • Single pass wireframe is implemented using nVidia's technique described on Solid Wireframe.
  • A basic shadow mapping algorithm is used to cast shadows on the terrain. Some percentage closer filtering (PCF) is applied to soften the aliased edges.
  • Fog is generated on the fragment shader as a function of distance to camera and altitude.

License

Licensed under the MIT license, see LICENSE for details.