Code Monkey home page Code Monkey logo

opengl-terrain-demo's Introduction

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

Requires driver support for OpenGL 4.5.

Screenshots

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.

opengl-terrain-demo's People

Contributors

madequa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.